sql_to_postgres

PlasmaCalcs.tools.sql_tools.sql_to_postgres(sql, *, dialect=UNSET, as_list=False, suppress_warnings=True)

transpile sql statement into postgres.

dialect: UNSET, None, or str

The dialect corresponding to the input SQL.
UNSET –> auto-detect; checks sqlite first, then postgres, then generic sql.
None –> use generic sql, i.e. sqlglot’s default dialect.
str –> e.g., “sqlite”, “postgres”. Can be any dialect string recognized by sqlglot.
as_list: bool
whether to return result as a list of sql statements.
False –> return as a single string, with statements separated by semicolons and newlines.
The last statement will not have a semicolon at the end.
True –> return a list of sql statements, none of which end with a semicolon.
suppress_warnings: bool or int
whether to suppress sqlglot warnings, e.g. about unsupported features of a dialect.