r/sqlite • u/datadanno • 7d ago
DDGBasic: a BASIC dialect where SQLite is built in, so SQL statements are just statements
Github Link here: https://github.com/ddgflorida/DDGBasic
DDGBasic wraps a procedural language around SQLite and DuckDB. SQL is written straight into the program, query results come back as rows you can loop over, and program variables go into queries as bind variables (:name). Around the SQL you get what SQL lacks: variables, IF rules, loops, functions, error handling, files, HTTP and a text-mode UI.
Load, clean and check data in one statement:
LOAD CSVcalls your own BASIC functions on every cell (TRANSFORM phone WITH normalize_phone$) and drops rows that fail a check (VALIDATE email WITH is_valid_email).Rules over query results:
FOR row IN (SELECT ...)loops apply logic that is awkward in SQL (tiers, allocations, alerts) and write back with bind variables, inside transactions.Two engines in one program: SQLite for records (a file, constraints, transactions), DuckDB for analytics (columnar, fast, querying Parquet and CSV files directly), with
DATABASE ENGINEto switch.Results anywhere: the same query to the console, CSV, JSON, Excel, Parquet, HTML or SQL, or to a grouped
REPORT.
The language is a modern BASIC, and it comes with 1990s-style text screens and a QBasic-style IDE. See Examples for programs that show this off.
Easy install with- pip install ddgbasic
ddgbasic examples/hello.bas # run a script
ddgbasic # interactive REPL
ddgbasic --ide examples/contact.bas # the QBasic-style IDE: F5 runs, F1 helps