SQLT(1p)
β¨ NAME β¨
okay so bestie, this is SQLT(1p) β the User Contributed Perl Documentation page for sqlt, and it does literally one iconic thing: convert SQL schema using SQL::Translator π
β¨
π¦ SYNOPSIS π¦
ngl the vibes here are "here's how you talk to me." For help:
sqlt -h|--help
For a list of all parsers and producers (the full roster, the whole cast π):
sqlt -l|--list
To translate a schema (the main character move):
sqlt -f|--from|--parser MySQL
-t|--to|--producer Oracle
[options]
file [file2 ...]
πΈ General Options
-d,--debugβ print debug info π-v,--validateβ validate the schema β--versionβ show the version ofSQL::Translator--traceβ print parser trace info π--show-warningsβ print warnings toSTDERRπ£οΈ
πΈ General Parser Options
--skipβ comma-separated list of tables to skip (only implemented in some parsers, so don't come for me if your fave doesn't do it π)--ignore_optsβ comma-separated list of table options to ignore
πΈ DBI Parser Options
--dsnβ DSN for connecting to database (see also--use-same-authbelow π)--db-userβ database user--db-passwordβ database password
πΈ xSV Parser Options
--fsβ the field separator--rsβ the record separator--no-trimβ don't trim whitespace on fields βοΈπ«--no-scanβ don't scan fields for data types and sizes
πΈ MySQL Parser Options
--mysql-parser-versionβ target MySQL parser version for dealing with/*!comments; default =30000
πΈ MySQL Producer Options
--mysql-versionβ MySQL server version
πΈ General Producer Options
--producer-db-userβ database user for producer--producer-db-passβ database password for producer--producer-dsnβ DSN for producer--use-same-authβ use these DSN, user, password for producer output
πΈ DB Producer Options
--add-drop-tableβ add'DROP TABLE'statements before creates π (yes it's giving destructive, that's the point)--quote-table-namesβ quote all table names in statements--quote-field-namesβ quote all field names in statements--no-commentsβ don't include comments in SQL output
πΈ PostgreSQL Producer Options
--postgres-versionβ PostgreSQL server version
πΈ Diagram Producer Options
--imap-fileβ filename to put image map data--imap-urlβ URL to use for image map
πΈ Dumper Producer Options
--skipβ comma-separated list of tables to skip--skiplikeβ regex for tables to skip--add-truncateβ add"TRUNCATE TABLE"statements for each table
πΈ HTML/POD Producer Options
--prettyβ useCGI::Prettyfor the output π--titleβ title of schema
πΈ TTSchema Producer Options
--templateβ the path to the template--tt-var var=valueβ pass extra variables to the template--tt-conf option=valueβ pass extra config options toTemplate
πΈ XML-SQLFairy Producer Options
--add-prefixβ use an explicit namespace prefix of'sqlf:'--prefix=<p>β use the namespace prefix given as argument.--no-newlinesβ write the XML as a single line.--indent=<n>β use<n>characters of whitespace to indent the XML.
πΈ ClassDBI Producer Options
--packageβ base package name forClass::DBImodules.
π DESCRIPTION π
so this script? it's part of the SQL Fairy project π§β¨ And what it does is genuinely so slay: it will try to convert any source file for which it has a grammar into any format for which it has a producer. Like. Any to any. No cap.
β οΈ If you're using"show-warnings,"be sure to redirectSTDERRto a separate file β do not skip this bestie, the warnings will absolutely jump into your output otherwise π
In bash, you could do this:
$ sql_translator.pl -f MySQL -t PostgreSQL --show-warnings \
file.sql 1>out 2>err
And the real flex: you can specify a parser or producer located in any module that Perl knows about, which means you can easily substitute your own π«Ά your own little custom parser, your own producer, iconic behavior honestly.
π AUTHOR π
Ken Youens-Clark <kclark@cpan.org>, darren chamberlain <darren@cpan.org>. π legends, fr fr.
π SEE ALSO π
SQL::Translator- <http://sqlfairy.sourceforge.net>
and that's the whole page bestie!! π this was written up for perl v5.40.0, dated 2024-11-23 β yeah it's giving vintage but it still ate π β¨ go convert something, you've got this π¦
π¦ where this page comes from
- debian trixie: libsql-translator-perl 1.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsql-translator-perl 1.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsql-translator-perl 1.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms