Convert a Oracle schema to Google BigQuery
Paste the CREATE TABLE statements from Oracle and ERD Designer draws them as a model. Change the model's target database to Google BigQuery and every column's datatype is converted. You review each change before it is applied, then generate the Google BigQuery script.
What changes in the sample
Converted to Google BigQuery, these columns of the sample above change type. Everything else keeps its type; names, keys, nullability and lists of allowed values are left as they are.
| Column | Oracle | Google BigQuery | Note |
|---|---|---|---|
CUSTOMERS.CUSTOMER_ID | NUMBER identity | INT64 | |
CUSTOMERS.EMAIL | VARCHAR2(255) | STRING | |
CUSTOMERS.FULL_NAME | NVARCHAR2(120) | STRING | |
CUSTOMERS.NOTES | CLOB | STRING | |
CUSTOMERS.CREATED_AT | DATE | DATETIME | default: SYSDATE → CURRENT_TIMESTAMP |
ORDERS.ORDER_ID | NUMBER identity | INT64 | |
ORDERS.CUSTOMER_ID | NUMBER | INT64 | |
ORDERS.STATUS | VARCHAR2(20) | STRING | |
ORDERS.TOTAL | NUMBER(12,2) | NUMERIC(12,2) | |
ORDERS.PLACED_AT | TIMESTAMP(6) WITH TIME ZONE | TIMESTAMP | |
ORDERS.RECEIPT_PDF | BLOB | BYTES |
What you are asked
Where Google BigQuery offers more than one fair answer, ERD Designer asks before it converts — once per kind of column, not once per column. For this page each question was answered with its first option:
ORDERS.STATUS — answered this column
this column— the list kept on the model as documentation — Google BigQuery cannot enforce it, so the DDL writes no constraintLookup table— a new table holding the values, keyed by the value itself, with a foreign key from this column
What it tells you
Where a conversion loses something, ERD Designer says so rather than picking for you. These are the messages for the sample:
- CUSTOMERS.CUSTOMER_ID: Google BigQuery will not number new rows for this key — it is a plain INT64. Number it by hand, or add the database's own auto-numbering after generating.
- ORDERS.ORDER_ID: Google BigQuery will not number new rows for this key — it is a plain INT64. Number it by hand, or add the database's own auto-numbering after generating.
- ORDERS.PLACED_AT: Google BigQuery timestamps take no fractional-second precision — "(6)" was dropped.
- BigQuery does not support UNIQUE constraints, so none was created for: CUSTOMERS (EMAIL).
- BigQuery does not support indexes, so none was created for: ORDERS (PLACED_AT).
The Google BigQuery script
This is what ERD Designer generates for the sample, for Google BigQuery. Our test suite applies this conversion to a real Google BigQuery server and then reads the database back to confirm it matches the model exactly.
-- NOTE: BigQuery keys are NOT ENFORCED — the clause does not parse without
-- that word. They inform the query optimiser and document intent; nothing
-- prevents a duplicate key or an orphaned reference.
-- Create table CUSTOMERS
CREATE TABLE `CUSTOMERS` (
`CUSTOMER_ID` INT64 NOT NULL,
`EMAIL` STRING NOT NULL,
`FULL_NAME` STRING NOT NULL,
`NOTES` STRING,
`CREATED_AT` DATETIME DEFAULT CURRENT_DATETIME() NOT NULL,
PRIMARY KEY (`CUSTOMER_ID`) NOT ENFORCED
);
-- Create table ORDERS
CREATE TABLE `ORDERS` (
`ORDER_ID` INT64 NOT NULL,
`CUSTOMER_ID` INT64 NOT NULL,
`STATUS` STRING DEFAULT 'new' NOT NULL,
`TOTAL` NUMERIC(12,2) NOT NULL,
`PLACED_AT` TIMESTAMP NOT NULL,
`RECEIPT_PDF` BYTES,
PRIMARY KEY (`ORDER_ID`) NOT ENFORCED
);
-- Add foreign key ORDERS (CUSTOMER_ID) → CUSTOMERS (CUSTOMER_ID)
ALTER TABLE `ORDERS` ADD CONSTRAINT `fk_ORDERS_CUSTOMER_ID` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `CUSTOMERS` (`CUSTOMER_ID`) NOT ENFORCED;
How to convert your own schema
- Paste your Oracle script above and click the Open in ERD Designer button. The model opens laid out and ready to edit.
- Click the model's name in the toolbar to open the Edit Model form dialog, select Google BigQuery in the Target Database / Version list, and click the Apply Changes button.
- If Google BigQuery offers more than one way to store a kind of column, choose one and click the Continue button.
- Read the list of retyped columns and any warnings, then click the Apply Conversion button. Save the model to keep it.
- Press Generate DDL (the database icon) to copy or download the Google BigQuery script — or apply it to a database on your own network with the ERD Designer Agent.
What it reads, and what it does not
- It reads
CREATE TABLE,ALTER TABLE … ADD CONSTRAINTandCREATE INDEX: tables, columns, keys, foreign keys, unique constraints, check lists and indexes. Anything else in the script is skipped and listed. - It converts the schema, never the data: no rows are read, moved or changed.
- It does not convert views, stored procedures, functions, triggers or packages.
Which plan you need
Pasting a script and working with it as a model is free on the Basic plan, with no card. Converting a model to another database is part of the Pro and Advanced plans, which also generate its script and can apply it through the Agent.
Other conversions
- Oracle to PostgreSQL
- Oracle to SQL Server
- Oracle to MySQL
- Oracle to MariaDB
- Oracle to SQLite
- Oracle to Amazon Redshift
- Oracle to Snowflake
- PostgreSQL to Google BigQuery
- SQL Server to Google BigQuery
- MySQL to Google BigQuery
- MariaDB to Google BigQuery
- SQLite to Google BigQuery
- Amazon Redshift to Google BigQuery
- Snowflake to Google BigQuery
Questions? Write to support@erddesigner.com. · ERD Designer™ · Terms · Privacy
ERD Designer™ is a trademark of ERD Designer, LLC.