Hi all. I need to turn some legacy SQL into honey sql data structures. Is there a tool somewhere to do essentially the reverse of what honey sql does? I need to eventually make the query much more dynamic and flexible as otherwise I’d just keep as-is and use hugsql instead.
I'm not aware of such a tool but you can use both libraries side by side and even together.
I used ChatGPT for this in the past, it was 80% there, I can only guess that it's even better now
Thanks both. Parsing SQL isn’t easy so I hadn’t expected much, but even if I can get over halfway, it will be better than nothing!
Hello guys.
I have a question about next.jdbc
I read docs multiple times but can’t find a way how to set the session variable on the connection
I’m using Postgres driver to access the CockroachDB (which should be compatible)
And I need to set a session variable multiple_active_portals_enabled=true
I tried to add this as a key into db spec like
{:dbtype "postgresql",
:host "...",
:port "26257",
:user "...",
:password "...",
:dbname "..."
:multiple_active_portals_enabled true}
but it doesn’t work .The db-spec elements become query parameters on the connection URL used to build the datasource and/or connection, i.e., not session variables.
is there a way to set session variable? maybe some special key?
I don't understand what you mean by "session variables". How would you specify this in raw SQL?
in the raw SQL it looks like SET multiple_active_portals_enabled=true;
JDBC has no concept of "session variables" exposed.
I saw some examples like this jdbc_connection_string => “jdbc:
That's DB specific, but would be {:dbtype "postgresql" ... :sessionVariables "multiple_active_portals_enabled=true"} assuming the PG driver supports that.
I tried that but it doesn’t work. Maybe Postgres doesn’t support that
Interesting. Seems it will work like this
{:options "-c multiple_active_portals_enabled=true"}
Yeah, you're kind of dependent on whatever DB-specific stuff works since that's all outside the scope of JDBC itself (and next.jdbc only knows about JDBC).
thank you
In Migratus, there is a distinction made between migrations and the "init script", with the latter standing alone outside the migration numbering. It doesn't really explain the purpose of this feature. What is the benefit of having a separate init script, rather than doing your initialization with normal migrations?
The init script can be created by any command that dumps your whole DB into an SQL file.
A migration file must be specially formatted.
It also makes the squashing process very obvious and easy.
And it's a descriptive name. init is much better than 19700101000001-init.
> A migration file must be specially formatted. Ahhh right, that's a key detail I missed.
Thank you!