{"id":20898,"library":"acryl-sqlglot","title":"SQLGlot","description":"SQLGlot is a no-dependency SQL parser, transpiler, and optimizer written in Python. It can parse a wide variety of SQL dialects, transpile between them, and produce formatted SQL. Current version is 25.25.2.dev9 (development release; stable releases follow semantic versioning and are frequent).","status":"active","version":"25.25.2.dev9","language":"python","source_language":"en","source_url":"https://github.com/tobymao/sqlglot","tags":["sql","parser","transpiler","formatter"],"install":[{"cmd":"pip install acryl-sqlglot","lang":"bash","label":"Install"}],"dependencies":[],"imports":[{"note":"The package name on PyPI is 'acryl-sqlglot' but the import module is 'sqlglot'.","symbol":"parse_one","correct":"from sqlglot import parse_one"},{"symbol":"transpile","correct":"from sqlglot import transpile"}],"quickstart":{"code":"import sqlglot\n\n# Parse and transpile SQL\nresult = sqlglot.transpile(\"SELECT * FROM table\", read='mysql', write='postgres')\nprint(result[0])  # Output: SELECT * FROM \"table\"\n\n# Pretty print\npretty = sqlglot.transpile(\"SELECT a,b FROM foo\", pretty=True)\nprint(pretty[0])","lang":"python","description":"Parse SQL, transpile between dialects, and format."},"warnings":[{"fix":"Use 'import sqlglot' or 'from sqlglot import ...'.","message":"Import from 'sqlglot', NOT 'acryl_sqlglot'. The PyPI package is 'acryl-sqlglot' but the Python module is 'sqlglot'.","severity":"gotcha","affected_versions":"all"},{"fix":"Use dialect classes like sqlglot.dialects.mysql.MySQL.","message":"In older versions (pre-10.0), the dialect API was different. The 'dialect' argument in parse_one was replaced with explicit dialect classes.","severity":"breaking","affected_versions":"<10.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with 'pip install acryl-sqlglot' but import as 'import sqlglot'.","cause":"Trying to import the PyPI package name directly.","error":"ModuleNotFoundError: No module named 'acryl_sqlglot'"},{"fix":"Use 'from sqlglot import parse_one' (not 'parse').","cause":"Attempting to import a non-existent function 'parse'.","error":"ImportError: cannot import name 'parse' from 'sqlglot'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}