You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently sqlx allows you to create a connection pool with custom pool options based on e.g.: the kind of database (extracted from the url) or anything else.
e.g.:
letmut connect_options = sqlx::any::AnyConnectOptions::from_str(&database_url).expect("Incorrect database url!");letmut pool_options = sqlx::any::AnyPoolOptions::new();if std::matches!(connect_options.kind(),AnyKind::Sqlite){let sqlite_connect_options = SqliteConnectOptions::from_str(&database_url).unwrap().create_if_missing(true);
connect_options = sqlite_connect_options.into();
pool_options = pool_options.max_connections(1);}let kind = connect_options.kind();
log::info!("Connecting to the database...");letmut pool = pool_options.connect_with(connect_options).await.expect("Unable to connect to the database!");
(I know that the sqlite create_if_missing option could be configured from the database url as well).
The user should have the ability to create and setup their own connection using sqlx. SeaQL should allow creating sea_orm::Database not just from a database url string but also from any sqlx::Executor.
I understand that SeaQL needs to know the kind of database to know which flavor of SQL to generate, but
This could be something that we could allow the user to specify along with giving an sqlx::Executor.
In the next release sqlx::AnyPool will have an any_kind method for getting the database kind, so that will be usefull and can be used to get the underlying database type.
The text was updated successfully, but these errors were encountered:
Currently sqlx allows you to create a connection pool with custom pool options based on e.g.: the kind of database (extracted from the url) or anything else.
e.g.:
(I know that the sqlite
create_if_missing
option could be configured from the database url as well).The user should have the ability to create and setup their own connection using sqlx. SeaQL should allow creating
sea_orm::Database
not just from a database url string but also from anysqlx::Executor
.I understand that SeaQL needs to know the kind of database to know which flavor of SQL to generate, but
sqlx::Executor
.sqlx::AnyPool
will have anany_kind
method for getting the database kind, so that will be usefull and can be used to get the underlying database type.The text was updated successfully, but these errors were encountered: