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

Add identifier filter to support dynamic and safe insertion of identifiers #33

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tomasfarias
Copy link

This PR adds an identifier filter to escape SQL identifiers, like table and field names. As mentioned in #32, this would allow for safe and dynamic insertion of table and field names. Currently, this is possible via the sqlsafe filter but we delegate the responsibility of escaping strings to the user.

The implementation will depend on database engine, which is why a new db_engine parameter was added. I've implemented the filter for escaping strings in Postgres, although I would be willing to include more alternatives in this PR if that's needed to be considered complete.

On invalid (not implemented or non-existent) engines, a ValueError is raised. Should I use instead a new exception inheriting from JinjaSqlException?

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.

1 participant