Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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!

asked 09 Oct '14, 16:06

Goutham's gravatar image

Goutham
46116
accept rate: 0%

edited 09 Oct '14, 16:10


I figured this out. The following worked:

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

answered 10 Oct '14, 12:11

Goutham's gravatar image

Goutham
46116
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×21
×2

question asked: 09 Oct '14, 16:06

question was seen: 3,605 times

last updated: 10 Oct '14, 12:11