My favorites
▼
|
Sign in
pyodbc
Python ODBC library
Project Home
Downloads
Wiki
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
43
attachment: test-mssql.py
(596 bytes)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pyodbc
CONN_STR_TMPL = "DRIVER={SQL Server};SERVER=%(host)s,%(port)s;DATABASE=%(db)s;UID=%(user)s;PWD=%(passwd)s"
params = {
'host':'127.0.0.1',
'port':'1433',
'db':'test',
'user': 'sa',
'passwd':'111111'}
conn = pyodbc.connect(CONN_STR_TMPL % params)
for row in conn.cursor().execute("SELECT * from sys.foreign_keys"):
print 'key ' + str(row.name)
for row in conn.cursor().foreignKeys("test1", params['db'], ""):
print 'fk ' + str(row)
for row in conn.cursor().tables("test1", params['db'], "", 'TABLE'):
print 'table ' + str(row)
Powered by
Google Project Hosting