pytd icon indicating copy to clipboard operation
pytd copied to clipboard

Does pytd have paramaterized query option?

Open ahummel25 opened this issue 4 years ago • 2 comments

I'm not seeing any option to pass parameterized query. This would be super helpful when you have None columns as null.

value = None
client.query("INSERT INTO table (column1) VALUES (%s)", (value)) --should insert record as null

ahummel25 avatar Oct 27 '21 17:10 ahummel25

Doesn't f string simply work?

column1 = None
client.query(f"INSERT INTO table (column1) VALUES ({column1 or 'NULL'})")

myui avatar Oct 28 '21 02:10 myui

Yeah I guess that would work too. It just becomes a bit verbose and messy when dealing with huge insert statements. Whereas None is inherently handled with paramaterized sql.

ahummel25 avatar Oct 28 '21 02:10 ahummel25