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


Usage: dbcrossbar schema conv [OPTIONS] <FROM_LOCATOR> <TO_LOCATOR>

Arguments:
  <FROM_LOCATOR>  The input schema
  <TO_LOCATOR>    The output schema

Options:
      --if-exists <IF_EXISTS>  One of `error`, `overrwrite` or `append` [default: error]
      --from-arg <FROM_ARGS>   Pass an extra argument of the form `key=value` to the source driver
      --to-arg <TO_ARGS>       Pass an extra argument of the form `key=value` to the destination driver
  -h, --help                   Print help

EXAMPLE LOCATORS:
    postgres-sql:table.sql
    postgres://localhost:5432/db#table
    bigquery-schema:table.json