Skip to main content

Create Table From Database SQL

Creates a Magpie table that references a SQL query from a database data source. Tables created using this command are read-only.

Syntax

create [temporary | temp] table { <target table name> | <target table spec> } [in schema <schema reference>]
from data source <data source reference> sql(<sql>)
[with bulk access]
[with fetch size <fetch size>]

Parameters

target table name

String — The name of the table to create.

target table spec

JSONA specification for the new table. Note that the persistence mapping and fields are not used when creating a table with this command.

schema reference

String — The name of the schema to save the table in. Defaults to the current schema.

data source reference

String — The name of the data source that the database query will be executed in.

sql

String — The SQL query that will be executed locally at the database to use as the source data for the table.

fetch size

Integer — The number of rows to fetch at once from a JDBC connection when reading from the table. Default 50,000.

with bulk access

None. If present, create table using bulk access connector rather than a traditional JDBC connector. Only valid for data sources that support bulk access (e.g., Redshift, Postgres).