schema conv
: Transforming schemas
The schema conv
command can be used to convert between different database schemas. To convert from a PostgreSQL CREATE TABLE
statement to a BigQuery schema, run:
dbcrossbar schema conv postgres-sql:table.sql bigquery-schema:table.json
As a handy trick, you can also use a CSV source, which will generate a CREATE TABLE
where all columns have the type TEXT
:
dbcrossbar schema conv csv:data.csv postgres-sql:table.sql
This can then be edited to specify appropriate column types.
Command-line help
Convert table schemas from one format to another
USAGE:
dbcrossbar schema conv [OPTIONS] <from-locator> <to-locator>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--if-exists <if-exists>
One of `error`, `overrwrite` or `append` [default: error]
ARGS:
<from-locator> The input schema
<to-locator> The output schema
EXAMPLE LOCATORS:
postgres-sql:table.sql
postgres://localhost:5432/db#table
bigquery-schema:table.json