Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to connect to a sybase database from python?

Tags:

python

sybase

I am trying to retrieve data in a sybase data base from python and I was wondering which would be the best way to do it. I found this module but may be you have some other suggestions: http://python-sybase.sourceforge.net/ Thanks

like image 982
Anninha Avatar asked Jul 23 '10 15:07

Anninha


1 Answers

The sybase module you linked is by far the easiest way. You can get data like so:

import Sybase

db = Sybase.connect('server','name','pass','database')
c = db.cursor()
c.execute("sql statement")
list1 = c.fetchall()

print list1

You will have to use something like freetds to setup the interfaces for sybase, however.

like image 195
Matthew Avatar answered Oct 11 '22 02:10

Matthew