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

support for variables in multi-line statements #156

Merged

Conversation

Lucaszw
Copy link
Contributor

@Lucaszw Lucaszw commented Jan 20, 2020

Closes #80 , #79

Although line_magic automatically replaces variables, cell_magic does not.

query = "name = 'bob'"
%%sql
select count(1) from users where {query}

To escape use multi-brackets:

%%sql
select '{{I'm in brackets}}'

@catherinedevlin
Copy link
Owner

I... I... I did not even know that {} variable substitution worked. I never wrote that in! It must be bubbling up from, um, somewhere.

But OK, if it works in one place it should definitely work in all places! Thank you!

@catherinedevlin catherinedevlin merged commit 0bc02a1 into catherinedevlin:master May 2, 2020
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

Successfully merging this pull request may close these issues.

Unable to use variables in multiline statements (%%sql)
2 participants