SQLT(1p)

πŸ“¦
version 1.66 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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 of SQL::Translator
  • --trace β€” print parser trace info πŸ”
  • --show-warnings β€” print warnings to STDERR πŸ—£οΈ

🌸 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-auth below πŸ‘€)
  • --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 β€” use CGI::Pretty for 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 to Template

🌸 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 for Class::DBI modules.

πŸ’… 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 redirect STDERR to 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 🌈


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