cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Connection String for SQLAlchemy-SQLAny api

Former Member
4,284

I am trying to connect to SQLAnywhere using the SQLAlchemy-SQLAny dialect for python. Here is my connection string format:

url="sqlalchemy_sqlany://user:pwd@localhost/D:\\database_file_path.db?ServerName=MyServer"

Here I want to connect to SQLAnywhere using a service named "MyServer" setup in my computer. But I get the following error:

sqlalchemy.exc.OperationalError: (OperationalError) Specified database not found None None

Though I am able to connect using the raw sqlanydb python api as:

conn=sqlanydb.connect(UserID="user",Password="pwd",DatabaseFile="D:\\database_file_path.db",ServerName="MyServer")

I just want to use the same with SQLAlchemy. Any help would be much appreciated!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

I figured this out. The following worked:

eng=sql.create_engine(url,connect_args={'dbf': "D:\\\\database_file_path.db", 
'ServerName':'MyServer'} 
)