Created
February 22, 2020 22:02
-
-
Save jamescalam/300d5f1e38159122f0aca6a9d129ec78 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
def manual(self, query, response=False): | |
cursor = self.cnxn.cursor() # create execution cursor | |
if response: | |
return read_sql(query, self.cnxn) # get sql query output to dataframe | |
try: | |
cursor.execute(query) # execute | |
except pyodbc.ProgrammingError as error: | |
print("Warning:\n{}".format(error)) # print error as a warning | |
self.cnxn.commit() # commit query to SQL Server | |
return "Query complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment