Last active
February 22, 2020 22:29
-
-
Save jamescalam/45bc65ce23076fce36e1276ea98af241 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 drop(self, tables): | |
# check if single or list | |
if isinstance(tables, str): | |
# if single string, convert to single item in list for for-loop | |
tables = [tables] | |
for table in tables: | |
# check for pre-existing table and delete if present | |
query = ("IF OBJECT_ID ('["+table+"]', 'U') IS NOT NULL " | |
"DROP TABLE ["+table+"]") | |
self.manual(query) # execute |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment