Skip to content

Commit

Permalink
Merge branch '3.10' of https://github.com/JumpMind/symmetric-ds.git i…
Browse files Browse the repository at this point in the history
…nto 3.10
  • Loading branch information
philipmarzullo64 committed Jun 5, 2019
2 parents c3e8df5 + 6996af1 commit 718ecc5
Show file tree
Hide file tree
Showing 4 changed files with 288 additions and 267 deletions.
111 changes: 56 additions & 55 deletions symmetric-assemble/src/asciidoc/appendix/dbexport.ad
@@ -1,56 +1,57 @@
=== DBExport

The DbExport utility has the ability to export the structure of data from database tables to file.

ifdef::pro[]
The DbExport wizard is available from the explore tab of the pro console.
The popup window asks for the catalog, schema, and specific table(s) to export to a file.

image::appendix/dbexport/dbexport-database-export-tab.png[width=600]

The next tab allows for specific choices for the format and content of the exported file.

image::appendix/dbexport/dbexport-format-screen.png[width=600]

The format option allows for choices between *SQL*, *XML*, *CSV*, and *SYM_XML*.
The Compatibility tab allows for a choice between any of the supported SQL dialects.
The list of check boxes allows for more specific options for the content of the file including insert, drop or create scripts. A where clause can also be added to make the SQL more specific.

The last option allows for the scripts to be exported as either a file or directly to the SQL editor within the pro console.

endif::pro[]

ifndef::pro[]

The dbexport utility can be run directly from the command line.
To run dbexport enter the command *dbexport [tablename...]* followed by any parameters from the command line in the bin directory of the Symmetric installation.
The *--help* parameter will display all the possible parameters for the export utility.
They are as follows:

- *--add-drop-table* : Add drop table commands to output.
- *--catalog <arg>* : Look for tables in catalog
- *--compatible <arg>* : Change export to be compatible with a given database: db2, db2zos, derby, firebird, greenplum, h2, hsqldb, hsqldb2, informix, interbase, mssql, mysql, oracle, postgres, sybase.
- *--debug* : Print debug information in logging.
- *--dir <arg>* : Indicate a directory to use for the export of files. If the directory is specified, then a file per table will be written to the directory.
- *-e, --engine <arg>* : The name of a configured engine. The name should correspond to an engine.name setting in one of the properties files in the engines directory.
- *--format <arg>* : Output format: SQL, CSV, XML, or SYM_XML.
- *-h, --help* : Print help with each option and description.
- *-i, --comments* : Write informational comments.
- *--no-create-info* : Do not write statements to create tables.
- *--no-data* : Do not write statements to insert into tables.
- *--no-foreign-keys* : Do not write statements to create foreign keys.
- *--no-indices* : Do not write statements to create indices.
- *--no-log-console* : No output will be sent to the console.
- *--no-log-file* : No output will be sent to the log file.
- *--no-qualifiers* : Do not qualify table and columns names with quoted identifiers.
- *-p, --properties <arg>* : The properties file with settings for the SymmetricDs engine. If not provided, defaults are used, then overridden with symmetric.properties values in user.home directory.
- *--schema <arg>* : Look for tables in schema.
- *--sql <arg>* : Run custom SQL to select data.
- *--use-jdbc-timestamp-format <arg>* : When true db export uses {ts 'yyyy-MM-dd h:mm:ss.SSS'} format for exported dates and times. Defaults to true.
- *--use-variable-dates* : Substitute dates as ${curdate+-millis}.
- *-v, --verbose* : Use verbose format for console output.
- *--where <arg>* : Specify the SQL for the "where" clause.

The same file formats utilized by dbimport are used for dbexport as well. Please see <<dbimport>> for format examples.

=== DBExport

The DbExport utility has the ability to export the structure of data from database tables to file.

ifdef::pro[]
The DbExport wizard is available from the explore tab of the pro console.
The popup window asks for the catalog, schema, and specific table(s) to export to a file.

image::appendix/dbexport/dbexport-database-export-tab.png[width=600]

The next tab allows for specific choices for the format and content of the exported file.

image::appendix/dbexport/dbexport-format-screen.png[width=600]

The format option allows for choices between *SQL*, *XML*, *CSV*, and *SYM_XML*.
The Compatibility tab allows for a choice between any of the supported SQL dialects.
The list of check boxes allows for more specific options for the content of the file including insert, drop or create scripts. A where clause can also be added to make the SQL more specific.

The last option allows for the scripts to be exported as either a file or directly to the SQL editor within the pro console.

endif::pro[]

ifndef::pro[]

The dbexport utility can be run directly from the command line.
To run dbexport enter the command *dbexport [tablename...]* followed by any parameters from the command line in the bin directory of the Symmetric installation.
The *--help* parameter will display all the possible parameters for the export utility.
They are as follows:

- *--add-drop-table* : Add drop table commands to output.
- *--catalog <arg>* : Look for tables in catalog
- *--compatible <arg>* : Change export to be compatible with a given database: db2, db2zos, derby, firebird, greenplum, h2, hsqldb, hsqldb2, informix, interbase, mssql, mysql, oracle, postgres, sybase.
- *--debug* : Print debug information in logging.
- *--dir <arg>* : Indicate a directory to use for the export of files. If the directory is specified, then a file per table will be written to the directory.
- *-e, --engine <arg>* : The name of a configured engine. The name should correspond to an engine.name setting in one of the properties files in the engines directory.
- *--exclude-columns <arg>* : A comma separated list of columns to exclude from the exported tables.
- *--format <arg>* : Output format: SQL, CSV, XML, or SYM_XML.
- *-h, --help* : Print help with each option and description.
- *-i, --comments* : Write informational comments.
- *--no-create-info* : Do not write statements to create tables.
- *--no-data* : Do not write statements to insert into tables.
- *--no-foreign-keys* : Do not write statements to create foreign keys.
- *--no-indices* : Do not write statements to create indices.
- *--no-log-console* : No output will be sent to the console.
- *--no-log-file* : No output will be sent to the log file.
- *--no-qualifiers* : Do not qualify table and columns names with quoted identifiers.
- *-p, --properties <arg>* : The properties file with settings for the SymmetricDs engine. If not provided, defaults are used, then overridden with symmetric.properties values in user.home directory.
- *--schema <arg>* : Look for tables in schema.
- *--sql <arg>* : Run custom SQL to select data.
- *--use-jdbc-timestamp-format <arg>* : When true db export uses {ts 'yyyy-MM-dd h:mm:ss.SSS'} format for exported dates and times. Defaults to true.
- *--use-variable-dates* : Substitute dates as ${curdate+-millis}.
- *-v, --verbose* : Use verbose format for console output.
- *--where <arg>* : Specify the SQL for the "where" clause.

The same file formats utilized by dbimport are used for dbexport as well. Please see <<dbimport>> for format examples.

endif::pro[]
Expand Up @@ -67,6 +67,8 @@ public class DbExportCommand extends AbstractCommandLauncher {

private static final String OPTION_WHERE = "where";

private static final String OPTION_EXCLUDE_COLUMNS = "exclude-columns";

public DbExportCommand() {
super("dbexport", "[tablename...]", "DbExport.Option.");
}
Expand Down Expand Up @@ -111,6 +113,7 @@ protected void buildOptions(Options options) {
addOption(options, null, OPTION_SQL, true);
addOption(options, null, OPTION_WHERE, true);
addOption(options, "i", OPTION_COMMENTS, false);
addOption(options, null, OPTION_EXCLUDE_COLUMNS, true);
}

@Override
Expand Down Expand Up @@ -178,7 +181,10 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
if (line.hasOption(OPTION_WHERE)) {
dbExport.setWhereClause(line.getOptionValue(OPTION_WHERE));
}

if (line.hasOption(OPTION_EXCLUDE_COLUMNS)) {
dbExport.setExcludeColumns(line.getOptionValue(OPTION_EXCLUDE_COLUMNS).split(","));
}

String[] args = line.getArgs();
if (line.hasOption(OPTION_SQL)) {
if (args.length != 1) {
Expand Down

0 comments on commit 718ecc5

Please sign in to comment.