Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does pytd have paramaterized query option? #111

Open
ahummel25 opened this issue Oct 27, 2021 · 2 comments
Open

Does pytd have paramaterized query option? #111

ahummel25 opened this issue Oct 27, 2021 · 2 comments

Comments

@ahummel25
Copy link

ahummel25 commented Oct 27, 2021

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 ahummel25 changed the title Does pydt have paramaterized query option? Does pytd have paramaterized query option? Oct 27, 2021
@myui
Copy link
Member

myui commented Oct 28, 2021

Doesn't f string simply work?

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

@ahummel25
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants