I am trying to connect to a SQL Server from Linux using sqlalchemy. This page shows DSN-based connection as below.
engine = create_engine("mssql+pyodbc://scott:tiger@some_dsn")
Is there a way to specify a database name using DSN? I am aware that we can specify a database name either in odbc.ini or a SQL query but I would like to know if we can also do something like this.
engine = create_engine("mssql+pyodbc://scott:tiger@some_dsn/databasename")
engine.execute("USE databasename")immediately after callingengine_createusing the normal DSN syntax?