https://kotlinlang.org logo
Title
d

Daniel

03/20/2023, 8:30 AM
Hi, I am trying to use exposed DSL to simplify accessing legacy SQL server database that already exists. I need only read-only access to some of the complex tables and I was curious, do I need to define all of their columns to do that or can I specify only the ones I am interested in?
b

Berkay Özkan

03/20/2023, 8:32 AM
Hi, afaik its enough to add only columns you need
e

Endre Deak

03/20/2023, 2:25 PM
technically the interested columns are enough since you are attempting to generate read queries only, but as soon as you try to replicate the db for some additional testing, you will need all the columns. In general I personally find it a good practice to try to achieve full DDL match (including indices, etc.) with the existing database and the Exposed-generated schema - that means you don't miss any details
d

Daniel

03/20/2023, 3:00 PM
Are there any code generators for exposed DSL table definitions (from real SQL tables schema)? I could not find any up-to-date and for MS SQL Server, but maybe I have missed something...
e

Endre Deak

03/20/2023, 3:16 PM
I'm not aware of any widely used generator, but I do know that some folks here were writing their own solution for this
s

spand

03/20/2023, 5:00 PM
There is an official expose gradle plug-in but it broke on our db so we had to roll our own
But it might be worth a try