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

feat: Add current_user variable and slugify filter to Jinja #1436

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

baumandm
Copy link
Contributor

@baumandm baumandm commented Apr 11, 2024

This PR adds two new Jinja predefined variables, as well as a custom slugify filter using the python-slugify package.

  • {{ current_user }}: Renders the current user's username
  • {{ current_user_email }}: Renders the current user's email address
  • {{ ... | slugify }}: Transforms the input into a slugified version with underscores, stripping spaces, Unicode, and special characters. This is suitable for generating table / column names dynamically, among other uses.

This works both ad hoc and in scheduled Data Docs. I updated the Template Guide documentation, and added additional test cases.

Screenshot 2024-04-11 at 09-13-58 Additional Jinja Variables _ Filters - Querybook
Screenshot 2024-04-11 at 9 11 57 AM
Screenshot 2024-04-11 at 9 12 04 AM

@baumandm baumandm force-pushed the external/jinja-current-user branch from 3e3078c to 965c660 Compare April 11, 2024 14:39
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.

None yet

1 participant