Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Server: Support explicit table schema prefix in queries #154

Closed
robvari opened this issue Jun 15, 2020 · 5 comments
Closed

SQL Server: Support explicit table schema prefix in queries #154

robvari opened this issue Jun 15, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@robvari
Copy link

robvari commented Jun 15, 2020

Hi.

We have an issue when using Ktorm with SQL Server. The queries do not work with a db user which has no default schema, since the schema defined in the connection (e.g. via spring data source) is ignored / not supported by the SQL server driver.

It would be good to be able to enforce a schema prefix in the queries / pass a schema in the entity definition.

E.g.

object DimDate : Table<Nothing>("DimDate", "MySchema") { ... }

=> 

SELECT * FROM MySchema.DimDate

It seems this is not possible right now. Is there a suggested work around?

@vincentlauvlwj
Copy link
Member

The same issue as #89

@robvari
Copy link
Author

robvari commented Jun 15, 2020

Thanks for checking my ticket. Yes, it is the same root issue. It is a bit more severe for SQL Server since the work around via connection URL is not working. Its not supported by SQL Server.

See e.g. https://docs.microsoft.com/en-us/sql/connect/jdbc/jdbc-4-1-compliance-for-the-jdbc-driver?view=sql-server-ver15

@hangingman
Copy link
Contributor

hangingman commented Jun 18, 2020

@vincentlauvlwj
Currently, this schema issues are opened by name of SQL Server(#154) and PostgreSQL(#89).
But I want this feature for MySQL also.
So, I think it may be core feature if there is no problem.

EDIT
In my case, I needed to set transaction for multiple tables on different schemas.
It's better to switch database schema before query or require user to specify schema if there is no schema specified.

@vincentlauvlwj
Copy link
Member

@hangingman Yes, will be a core feature.

@vincentlauvlwj
Copy link
Member

Supported in Ktorm 3.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants