Skip to content
BI Data

SQL → ORM Code: SQLAlchemy, Eloquent and Doctrine

About this tool

Convert supported SELECT query patterns into code for ORM and query builder libraries. Use the output as a starting point for moving SQL into application code.

  • SQL → Python (SQLAlchemy)
  • SQL → PHP (Eloquent, Doctrine)
  • Other targets, such as Knex and ActiveRecord, are not currently supported.

Supported: field selection and *, DISTINCT, aggregates (COUNT / SUM / AVG / MIN / MAX), JOIN (INNER / LEFT / RIGHT) with ON, WHERE with AND / OR and operators = != < > <= >= LIKE IN BETWEEN IS NULL, GROUP BY, HAVING, ORDER BY, LIMIT / OFFSET.

Not supported yet: subqueries, UNION, CTEs (WITH), window functions and complex nested WHERE parentheses. Model names are inferred from table names; adjust them to match your application.

More tools

Free tools for analysts and developers