Skip to content

Instantly share code, notes, and snippets.

@dtaivpp
Last active September 7, 2019 15:31
Show Gist options
  • Save dtaivpp/5bc70a5407e81d25f41b30941b1dee11 to your computer and use it in GitHub Desktop.
Save dtaivpp/5bc70a5407e81d25f41b30941b1dee11 to your computer and use it in GitHub Desktop.
This is an example of how not to generate sql table queries dynamically
def gen_table_sql(table_obj):
row_len = length(table_obj)
query = ""
for index, row in enumerate(table_obj['columns']):
query.append(row)
# Needed so last line doesnt have a comma
if (index < length):
query.append(',\n')
return query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment