kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
9.82k stars 250 forks source link

Invalid object name upon inserting value into temp table in mssql #974

Closed benedictngjh96 closed 2 months ago

benedictngjh96 commented 2 months ago

Hi, i am using mssql and encountering this error upon inserting value into the temp table. I am using the camel case plugin as well.

RequestError: Invalid object name '#_temp'.

playground

koskimas commented 2 months ago

Works as expected. The table name is converted from camelCase to snake_case.

benedictngjh96 commented 2 months ago

Yes it converts the name but how do i deal with the invalid object name error?

koskimas commented 2 months ago

The error is caused by the invalid name that you specifically asked Kysely to use. Don't use the invalid name. See the docs here on how to implement custom snake_case --> camelCase and camelCase --> snake_case conversions https://kysely-org.github.io/kysely-apidoc/classes/CamelCasePlugin.html