Created
February 22, 2020 19:27
-
-
Save jamescalam/9f6249ae0aaae2753232ceca2d68aec3 to your computer and use it in GitHub Desktop.
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 | |
from datetime import datetime | |
class Sql: | |
def __init__(self, database, server="XXVIR00012,55000"): | |
# here we are telling python what to connect to (our SQL Server) | |
self.cnxn = pyodbc.connect("Driver={SQL Server Native Client 11.0};" | |
"Server="+server+";" | |
"Database="+database+";" | |
"Trusted_Connection=yes;") | |
# initialise query attribute | |
self.query = "-- {}\n\n-- Made in Python".format(datetime.now() | |
.strftime("%d/%m/%Y")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment