Dump a clean version of the DDLs of your tables, so you can version them.


Keywords
ddldump, ddl, dump, sql, mysql, postgresql, sqlalchemy, mysqldump, pg_dump
License
GPL-3.0
Install
pip install ddldump==0.6.3

Documentation

ddldump

CircleCI

Dump and version the DDLs of your tables, while cleaning the dumps of all the varying stuff, like MySQL's AUTOINCs, that would make it hard to version and check for differences during continuous integration.

Usage

ddldump <dsn> [table] > table.sql

Example

Dump all the table DDLs of the MySQL database cooldb:

ddldump mysql://localhost/cooldb > cooldb.sql

Dump the specific DDL of the awesome PostgreSQL table. (requires postgresql-client, matching the server version, to be installed):

ddldump postgresql://localhost/mydb awesome > awesome.sql

Compare your dump with what's actually in your database:

$ ddldump --diff=cooldb.sql mysql://localhost/cooldb
--- mysql

+++ cooldb.sql

@@ -14,7 +14,7 @@


 -- Create syntax for TABLE 'user'
 CREATE TABLE `user` (
-  `id` bigint(20) unsigned COMMENT 'The user ID',
+  `id` bigint(20) unsigned NOT NULL COMMENT 'The user ID',
   `name` varchar(64) NOT NULL COMMENT 'The user name',
   PRIMARY KEY (`id`)

Install

pip install ddldump

Upload a new version

  1. Set a new version in ddldump/constants.py
  2. Open a PR, get it reviewed, get it merged
  3. git tag <version>
  4. git push --tags
  5. make release