Coder Social home page Coder Social logo

noql's Issues

Support CURRENT_DATE()

Please add support for CURRENT_DATE().

I currently get Error: Function:CURRENT_DATE not available.

My query:

SELECT COUNT(*) as count, MONTH(data.returnDate) as month 
FROM package 
WHERE YEAR(data.returnDate) = YEAR(CURRENT_DATE()) 
GROUP BY MONTH(data.returnDate)

Support for Insert, Update, and Delete

It would be cool to see this library work for basic create-update-delete operations. No need to support anything crazy like subqueries, etc.

I'd be willing to take a stab at the PR for it if this isn't an easy feature to implement ๐Ÿ˜„

Conditional Clauses in SQL Join Don't Work

Example:

      select a.ID as aId,
             b.name as bName
      from   [something.tablea] a
      join   [something.tableb] b on a.ID = b.ID and b.IsDeleted = 'false'

This query (and ones more complicated, where a conditional in a join makes sense) will fail. This will throw the error in makeFilterCondition.js: invalid expression type for array sub select:bool, as it identifies the conditional in the join as a subselect. Simply adding 'bool' to the array on line 169 in the same file fixes this issue.

NOT LIKE

Is there a way to achieve a NOT LIKE statement? Thanks!

Simple Relational Query throws an error

const SQLParser = require('@synatic/noql');

Promise.resolve()
.then(async function () {

	const query = `select A.name, B.name, C.name
from \`user-books\` as UB, books as B, users as A, authors as C
where UB.book = B._id AND UB.user = A._id AND B.author = C._id
`;

	const parsedSQL = SQLParser.parseSQL(query);

	console.log(parsedSQL);

})
.catch(err => console.error(err));

Throws an error

TypeError: Cannot read properties of undefined (reading 'left')
    at shouldPrefixSide ($project\node_modules\@synatic\noql\lib\make\makeJoinForPipeline.js:236
:30)
    at makeJoinPart ($project\node_modules\@synatic\noql\lib\make\makeJoinForPipeline.js:104:24)
    at Object.makeJoinForPipeline ($project\node_modules\@synatic\noql\lib\make\makeJoinForPipel
ine.js:48:9)
    at Object.makeAggregatePipeline ($project\node_modules\@synatic\noql\lib\make\makeAggregateP
ipeline.js:234:52)
    at makeMongoAggregate ($project\node_modules\@synatic\noql\lib\make\index.js:26:47)
    at SQLParser.parseSQL ($project\node_modules\@synatic\noql\lib\SQLParser.js:69:16)
    at $project\index.js:11:30

Basic subquery not working

select * from (select id,First Name,Last Name,arrayLength(Rentals,'id') as rentalCount from customers) as t

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.