moj-analytical-services / pydbtools

Python version of dbtools
https://moj-analytical-services.github.io/pydbtools/
11 stars 2 forks source link

Single line (--) comments cannot be parsed by get_sql_from_file #49

Open odaniel1 opened 2 years ago

odaniel1 commented 2 years ago

This could just be me, but using pydbtools 4.0.1 (current release at time of writing), queries read in using get_sql_from_file fail to parse if they include single line -- comments:

import pydbtools as pydb

with open('test.sql', 'w') as f:
    f.write('--\nselect 1 AS one')

qry = pydb.get_sql_from_file("test.sql")
response = pydb.start_query_execution_and_wait(qry)
print(response.get("Status"))