Question: Best way to set a Connection String Parameter?
Mousaka opened this issue · 1 comments
I'm wondering what the best way to set a connection string parameter, namely this one Command Timeout
, given an existing setup done in such a manner:
databaseUrl
|> Sql.fromUri
|> Sql.connect
|> Sql.executeTransactionAsync transaction
My best idea so far is to do
databaseUrl
|> Sql.fromUri
|> (fun connectionString -> connectionString + "; Command Timeout=600")
|> Sql.connect
|> Sql.executeTransactionAsync transaction
...but it feels a bit hacky and like maybe I'm missing some better way to do it (and I'm not sure it works yet). Am I missing something?
Must I stop using URI postgres connection format and start using this style (code from readme) in order to be able to add configurations?:
// (2) hardcoded
let connectionString = "Host=localhost; Database=dvdrental; Username=postgres; Password=postgres;"
Thankful for any help!
Cheers
Hi there @Mousaka, the way you are adding a parameter is OK! However, using the format PARAMETER=VALUE;
is indeed the default way of setting up connection strings. I've added Sql.fromUri
support because sometimes you don't have control over where the connection string comes from: i.e. from Heroku where they give you a URL but if you have control over the connection string, then just use the default format.
Hope this helps! I'll close the issue for now. Feel free to re-open if the problem persists