SQL Server: Support explicit table schema prefix in queries
See original GitHub issueHi.
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?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Bad Habits to Kick : Avoiding the schema prefix - SQLBlog.org
Without an explicit schema, SQL Server will first look under the schema associated with your login. This can cause problems, obviously, ...
Read more >Why you should always use schema name in queries
The reason is simple: SQL Server does cache the query plan for ad-hoc queries, but if the schema name isn't present in the...
Read more >How to pass schema prefix to queries that don't contain it
Set the default schema for the user to the schema that your queries need to use. ALTER USER [UserName] WITH DEFAULT_SCHEMA=[SchemaName].
Read more >The dbo. prefix in database object names, can I ignore it?
If you have all table names explicitly qualified as dbo.x then you cannot change to a different schema without search and replace through...
Read more >Add namespaces to queries using WITH XMLNAMESPACES
The following query explicitly defines the namespace prefix to URI binding for the predefined namespace ( urn:schemas-microsoft-com:xml-sql ).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Supported in Ktorm 3.1.0
@hangingman Yes, will be a core feature.