on 2014 Oct 09 5:06 PM
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!
Request clarification before answering.
I figured this out. The following worked:
eng=sql.create_engine(url,connect_args={'dbf': "D:\\\\database_file_path.db",
'ServerName':'MyServer'}
)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
41 | |
15 | |
10 | |
9 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.