Query Variables

SQL queries commonly have a where condition for a specific ID or date range. Wouldn’t it be nice to extract that into a variable? For example, show me users that belong to $organization_id, or users created after $start_date. If you’re sharing SQL queries with non technical folks, what if they could edit the variable without changing the any code?

Now in PopSQL, you can have variables in your SQL queries. To create a variable, simply wrap you variable in double curly braces, like {{id}}:

Screenshot of a query variable

This feature is available now for Premium members. Please see our docs on query variables for full information - enjoy!