Created
March 24, 2011 13:40
-
-
Save dpritchett/885069 to your computer and use it in GitHub Desktop.
Sample pyodbc code to read a log table out of SQL Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyodbc | |
cnxn = pyodbc.connect('DSN=production_rdmbs') | |
cursor = cnxn.cursor() | |
cursor.execute("SELECT [Trigger_Name] \ | |
,[Table_Ready] \ | |
,[Date_Modified] \ | |
FROM triggers_table_name") | |
rows = cursor.fetchall() | |
def listLoggedTrigger(row): | |
print row[0] + "\t" + row[2].strftime('%c') | |
[listLoggedTrigger(r) for r in rows] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment