从 python 连接到 sybase 数据库的最佳方法是什么? [英] What is the best way to connect to a sybase database from python?

查看:60
本文介绍了从 python 连接到 sybase 数据库的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 python 检索 sybase 数据库中的数据,我想知道哪种方法是最好的方法.我找到了这个模块,但你可能还有其他一些建议:http://python-sybase.sourceforge.net/谢谢

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

推荐答案

您链接的 sybase 模块是迄今为止最简单的方法.您可以像这样获取数据:

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

然而,您将不得不使用类似 freetds 的东西来设置 sybase 的接口.

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

这篇关于从 python 连接到 sybase 数据库的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆