SneakOnYou
New dialect for snowflake - quotes and case sensitivity
Snowflake has different behavior compared to Postgres and other dialects currently in Kysely, I want to be able to control the casing of all identifiers / tables / schemas
meaning that if I have
query.selectFrom("table").select(["id"])
I want it to compile to the exact case as it is specified, and also to be able to control if with a configuration to the query compiler (this I imagine is just a simple amendment to the constructor)
which functions should be overridden in the query compiler ?
Thank you in advance:typescript: :kysely:
9 replies
Help with implementation of new dialect for snowflake
Hello,
I am trying to create a new dialect for snowflake, I am focusing on the query compiling part.
As I have read I saw that the snowflake dialect is supports standard SQL, however I don't know what does that mean when it comes to the
DefaultQueryCompiler
There are several things that snowflake does not support, such as indices.
Do I need to throw when there is a visitDropIndex
or visitDropIndex
?
Are there any other things I should look out for ?
What happens if I want to use function that are in snowflake, how do I acheive it ?4 replies
$if with sql.raw doesn't compile
Hey,
I have updated my kysely version after I deleted node_modules and npm installed and I am getting an error for the following code:
![postgres](https://cdn.discordapp.com/emojis/1073953306667397161.png)
const filterWhereQuery = sql.raw(
LOWER("${dimensionName}") LIKE '%${filter?.toLowerCase()}%');
The error in at the 1st if where there is suddenly a type problem:
Argument of type 'RawBuilder<unknown>' is not assignable to parameter of type 'ExpressionOrFactory<any, ${string}.${string}
, SqlBool>'.
Property 'isSelectQueryBuilder' is missing in type 'RawBuilder<unknown>' but required in type 'SelectQueryBuilderExpression<Record<string, SqlBool>>'
what can I do to fix this quickly that doesn't require a huge change ? ![postgres](https://cdn.discordapp.com/emojis/1073953306667397161.png)
4 replies
issue with complied sql when doing + interval operation
Hey,
I have a query that is generated using kysely where I select the following field sql that I get as a string from a file:
fields = [close_date + interval '12 month']
what happens is that when I do .select(fields)
the close_date + interval '12 month' gets wrapped in double quotes, what is the best way to correct this
![postgres](https://cdn.discordapp.com/emojis/1073953306667397161.png)
![postgres](https://cdn.discordapp.com/emojis/1073953306667397161.png)
26 replies