Skip to main content

Create Table

Cria uma nova tabela no Snowflake com schema especificado.

Endpoint​

POST /storage-explorer/tables

Permissões Requeridas​

  • STORAGE_EXPLORER.WRITE

Request Body​

CampoTipoObrigatórioDescrição
table_namestringSimNome da tabela
schema_namestringSimSchema onde a tabela será criada
columnsarraySimLista de colunas da tabela
columns[].namestringSimNome da coluna
columns[].typestringSimTipo de dado (VARCHAR, INTEGER, TIMESTAMP, etc.)
columns[].nullablebooleanNãoSe a coluna aceita NULL (padrão: true)
columns[].primary_keybooleanNãoSe a coluna é chave primária
descriptionstringNãoDescrição da tabela

Tipos de Dados Suportados​

  • VARCHAR(n) - String de tamanho variável
  • INTEGER - Número inteiro
  • BIGINT - Número inteiro grande
  • DECIMAL(p,s) - Número decimal
  • FLOAT - Número de ponto flutuante
  • TIMESTAMP - Data e hora
  • DATE - Data
  • BOOLEAN - Booleano
  • JSON - JSON/VARIANT

Exemplo de Requisição​

curl -X POST "https://maestro.dadosfera.ai/storage-explorer/tables" \
-H "Authorization: <JWT_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"table_name": "customer_orders",
"schema_name": "RAW_DATA",
"description": "Tabela de pedidos de clientes",
"columns": [
{
"name": "order_id",
"type": "VARCHAR(50)",
"nullable": false,
"primary_key": true
},
{
"name": "customer_id",
"type": "VARCHAR(50)",
"nullable": false
},
{
"name": "order_date",
"type": "TIMESTAMP",
"nullable": false
},
{
"name": "total_amount",
"type": "DECIMAL(10,2)",
"nullable": true
},
{
"name": "status",
"type": "VARCHAR(20)",
"nullable": false
}
]
}'

Exemplo de Resposta​

Success (201 Created):

{
"table_id": "tbl_a1b2c3d4e5f6",
"table_name": "customer_orders",
"schema_name": "RAW_DATA",
"full_name": "RAW_DATA.customer_orders",
"created_at": "2024-01-15T10:30:00Z",
"columns": [
{
"name": "order_id",
"type": "VARCHAR(50)",
"nullable": false,
"primary_key": true
},
{
"name": "customer_id",
"type": "VARCHAR(50)",
"nullable": false,
"primary_key": false
},
{
"name": "order_date",
"type": "TIMESTAMP",
"nullable": false,
"primary_key": false
},
{
"name": "total_amount",
"type": "DECIMAL(10,2)",
"nullable": true,
"primary_key": false
},
{
"name": "status",
"type": "VARCHAR(20)",
"nullable": false,
"primary_key": false
}
],
"description": "Tabela de pedidos de clientes"
}

Códigos de Status​

CódigoDescrição
201Tabela criada com sucesso
400Parâmetros inválidos ou nome de tabela inválido
401Não autenticado
403Sem permissão STORAGE_EXPLORER.WRITE
409Tabela já existe
500Erro ao criar tabela no Snowflake