Create a table using the result of the specified select query

POST {{baseUrl}}/api/v2/databases/:database/schemas/:schema/tables:as-select?createMode=errorIfExists&copyGrants=false&query=<string>

Create a table as select.

Request Params

KeyDatatypeRequiredDescription
createModestringQuery parameter allowing support for different modes of resource creation. Possible values include:
  • errorIfExists: Throws an error if you try to create a resource that already exists.
  • orReplace: Automatically replaces the existing resource with the current one.
  • ifNotExists: Creates a new resource when an alter is requested for a non-existent resource. | | copyGrants | boolean | | Query parameter to enable copy grants when creating the object. | | query | string | | (Required) The SQL select query to run to set up the table values (and possibly columns). |

Request Body

{"name"=>"<string>", "columns"=>[{"name"=>"<string>", "datatype"=>"<string>", "nullable"=>true, "collate"=>"<string>", "default"=>"<string>", "autoincrement"=>"<boolean>", "autoincrement_start"=>"<integer>", "autoincrement_increment"=>"<integer>", "constraints"=>[{"name"=>"<string>", "column_names"=>["<string>", "<string>"], "constraint_type"=>"<string>"}, {"name"=>"<string>", "column_names"=>["<string>", "<string>"], "constraint_type"=>"<string>"}], "comment"=>"<string>"}, {"name"=>"<string>", "datatype"=>"<string>", "nullable"=>true, "collate"=>"<string>", "default"=>"<string>", "autoincrement"=>"<boolean>", "autoincrement_start"=>"<integer>", "autoincrement_increment"=>"<integer>", "constraints"=>[{"name"=>"<string>", "column_names"=>["<string>", "<string>"], "constraint_type"=>"<string>"}, {"name"=>"<string>", "column_names"=>["<string>", "<string>"], "constraint_type"=>"<string>"}], "comment"=>"<string>"}], "cluster_by"=>["<string>", "<string>"]}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring

RESPONSES

status: OK

{&quot;status&quot;:&quot;\u003cstring\u003e&quot;}