The SQL Parameter

The sql parameter lets you filter, sort, aggregate, and transform your data using SQL queries — directly in the URL. The query runs against your data after it's fetched from the source, using SQLite

How It Works

  1. CSV Getter fetches your full dataset from Airtable/Notion/CSV.

  2. The data is loaded into an in-memory SQLite database as a table called csvgetter.

  3. Your SQL query runs against that table.

  4. The filtered/transformed result is returned.

Important: The table name is always csvgetter. Use this in your FROM clause.


Basic Syntax

?sql=SELECT * FROM csvgetter

URL-encoded:

?sql=SELECT%20*%20FROM%20csvgetter

Tip: The URL Wizard in the dashboard builds and encodes URLs for you automatically.


Examples

1. Select All Data

SELECT * FROM csvgetter

2. Select Specific Columns

3. Filter with WHERE

4. Multiple Conditions (AND / OR)

5. Comparison Operators

6. LIKE (Pattern Matching)

7. IN (Multiple Values)

8. ORDER BY (Sorting)

9. LIMIT (Row Count)

10. LIMIT with OFFSET (Pagination)

This skips the first 20 rows and returns the next 10.

11. COUNT (Aggregation)

Sample output (as JSON):

12. SUM, AVG, MIN, MAX

13. GROUP BY

14. GROUP BY with HAVING

15. DISTINCT

16. NULL Handling

17. String Functions

18. CASE Expressions

19. Column Aliases


Column Names with Spaces

If your column names contain spaces, wrap them in double quotes:


Combining SQL with Other Parameters

The sql parameter works alongside other URL parameters:

Processing order:

  1. Data is fetched from the source

  2. sql query is applied

  3. type formatting is applied

  4. Side effects (email_me, save_to_gdrive, etc.) execute


Error Handling

If your SQL is invalid, you'll get a 400 response:

Common errors:

Error
Cause
Fix

no such column: X

Column name doesn't exist

Check your field names in the endpoint config

no such table: X

Wrong table name

Always use FROM csvgetter

near "X": syntax error

SQL syntax error

Check your SQL syntax

unrecognized token

Special characters not handled

Use URL encoding


Supported SQL Features (SQLite)

Since the SQL engine uses SQLite, you have access to:

  • SELECT, FROM, WHERE, ORDER BY, GROUP BY, HAVING, LIMIT, OFFSET

  • Aggregate functions: COUNT, SUM, AVG, MIN, MAX

  • String functions: UPPER, LOWER, LENGTH, SUBSTR, TRIM, REPLACE

  • LIKE, IN, BETWEEN, IS NULL, IS NOT NULL

  • CASE ... WHEN ... THEN ... ELSE ... END

  • DISTINCT

  • AND, OR, NOT

  • Comparison: =, !=, <, >, <=, >=

  • Math: +, -, *, /, %, ABS, ROUND

Not supported:

  • JOIN (there's only one table)

  • INSERT, UPDATE, DELETE (read-only)

  • CREATE TABLE, ALTER TABLE, DROP (read-only)

  • Subqueries (limited support — depends on complexity)

Last updated