Created
January 29, 2018 23:49
-
-
Save dafma/68c9e242ff6c8754f9d415e72c157815 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
""" Guarda un dato como xml | |
xml = "<myxmldata/>".encode() | |
f = open("myxmlfile.xml", "wb") | |
f.write(xml) | |
f.close() | |
""" | |
import pyodbc | |
# Specifying the ODBC driver, server name, database, etc. directly | |
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=LPGHCONSULTORES;UID=sa;PWD=') | |
cursor = cnxn.cursor() | |
cursor.execute("select movid, documento from cfd where timbrado='1' ") | |
rows = cursor.fetchall() | |
for row in rows: | |
xml = row.documento.encode() | |
f = open("C:\\basurero\\%s.xml" % row.movid, "wb") | |
f.write(xml) | |
f.close() | |
print("creado") | |
""" | |
from sqlalchemy import create_engine | |
engine = create_engine('mssql+pymssql://sa:@localhost:52865/LPGCONSULTORES') | |
conn = engine.connect() | |
rows = conn.execute("select name FROM sys.databases;") | |
for row in rows: | |
print(row["name"]) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment