knex / knex

A query builder for PostgreSQL, MySQL, CockroachDB, SQL Server, SQLite3 and Oracle, designed to be flexible, portable, and fun to use.
https://knexjs.org/
MIT License
19.23k stars 2.12k forks source link

Adding support for AlaSQL dialect #1280

Open elhigu opened 8 years ago

elhigu commented 8 years ago

If someone feels like pulling this through, there is initial implementation found in https://github.com/tgriesser/knex/pull/1063

vellotis commented 8 years ago

It would be a great benefit if we could use AlaSQL dialect instead of SQLite as it doesnt need to GNU build anything. Sadly this mentioned PR #1063 is one year behind. And as it was understood from the discussion there is too few documentation for AlaSQL to consider supporting it fully.

But maybe it could be solved the other way by allowing to use our own dialects by providing it in initialization config? src/inrex.js#L17-L22

/*17*/  if (arguments.length === 0 || (!config.client && !config.dialect)) {
/*18*/    Dialect = makeClient(Client)
/*++*/  } else if (typeof config.client === 'function' && config.client.prototype instanceOf Client) {
/*++*/    Dialect = makeClient(config.client)
/*19*/  } else {
/*20*/    var clientName = config.client || config.dialect
/*21*/    Dialect = makeClient(require('./dialects/' + (aliases[clientName] || clientName) + '/index.js'))
/*22*/  }

This way we could use any custom dialect apart from knex ones. @elhigu or is there a way to achieve this some other way?

rhys-vdw commented 8 years ago

@vellotis that sounds like a fine change. I'm surprised it's not already supported.

elhigu commented 8 years ago

@vellotis I like the idea 👍

vellotis commented 8 years ago

AqlSQL dialect published as a separate package knex-alasql. Currently doesn't meet the requirements for PR. But may be possible in the future.