MySQL

The sq MySQL driver implements connectivity for the MySQL and MariaDB databases. The driver implements all optional driver features.

Add source

Use sq add to add a source. The location argument should start with mysql://. For example:

sq add 'mysql://sakila:p_ssW0rd@localhost/sakila'

Inspect field provenance

sq inspect populates the fields below from the MySQL server variables and information_schema.

Source-level fields

FieldSource
name, schemaDATABASE() (MySQL conflates database and schema)
catalogINFORMATION_SCHEMA.SCHEMATA.CATALOG_NAME (always def per the SQL standard for MySQL)
userCURRENT_USER()
db_productcomposed: "@@GLOBAL.version_comment @@GLOBAL.version / @@GLOBAL.version_compile_os (@@GLOBAL.version_compile_machine)"
db_version@@GLOBAL.version
sizeSELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()

Per-table fields

FieldSource
row_countlive SELECT COUNT(*) FROM `tbl`
size(DATA_LENGTH + INDEX_LENGTH) from information_schema.TABLES