All URIs are relative to /
Method | HTTP request | Description |
---|---|---|
add_table_column | POST /db/{db_branch_name}/tables/{table_name}/columns | Creates a new column |
create_table | PUT /db/{db_branch_name}/tables/{table_name} | Create table |
delete_column | DELETE /db/{db_branch_name}/tables/{table_name}/columns/{column_name} | Deletes a column |
delete_table | DELETE /db/{db_branch_name}/tables/{table_name} | Delete table |
get_column | GET /db/{db_branch_name}/tables/{table_name}/columns/{column_name} | Get column information |
get_table_columns | GET /db/{db_branch_name}/tables/{table_name}/columns | Get the columns |
get_table_schema | GET /db/{db_branch_name}/tables/{table_name}/schema | Get table schema |
set_table_schema | PUT /db/{db_branch_name}/tables/{table_name}/schema | Update table schema |
update_column | PATCH /db/{db_branch_name}/tables/{table_name}/columns/{column_name} | Updates a column |
update_table | PATCH /db/{db_branch_name}/tables/{table_name} | Update table |
InlineResponse2006 add_table_column(db_branch_name, table_name, body=body)
Creates a new column
Adds a new column to the table. The body of the request should contain the column definition. In the column definition, the 'name' field should contain the full path separated by dots. If the parent objects do not exists, they will be automatically created. For example, passing \"name\": \"address.city\"
will auto-create the address
object if it doesn't exist.
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
body = XataClient.Column() # Column | The column definition. (optional)
try:
# Creates a new column
api_response = api_instance.add_table_column(db_branch_name, table_name, body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling TableApi->add_table_column: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name | |
body | Column | The column definition. | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
create_table(db_branch_name, table_name)
Create table
Creates a new table with the given name. Returns 422 if a table with the same name already exists.
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
try:
# Create table
api_instance.create_table(db_branch_name, table_name)
except ApiException as e:
print("Exception when calling TableApi->create_table: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name |
void (empty response body)
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse2006 delete_column(db_branch_name, table_name, column_name)
Deletes a column
Deletes the specified column. To refer to sub-objects, the column name can contain dots. For example address.country
.
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
column_name = XataClient.ColumnName() # ColumnName | The Column name
try:
# Deletes a column
api_response = api_instance.delete_column(db_branch_name, table_name, column_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling TableApi->delete_column: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name | |
column_name | ColumnName | The Column name |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_table(db_branch_name, table_name)
Delete table
Deletes the table with the given name.
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
try:
# Delete table
api_instance.delete_table(db_branch_name, table_name)
except ApiException as e:
print("Exception when calling TableApi->delete_table: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name |
void (empty response body)
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Column get_column(db_branch_name, table_name, column_name)
Get column information
Get the definition of a single column. To refer to sub-objects, the column name can contain dots. For example address.country
.
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
column_name = XataClient.ColumnName() # ColumnName | The Column name
try:
# Get column information
api_response = api_instance.get_column(db_branch_name, table_name, column_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling TableApi->get_column: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name | |
column_name | ColumnName | The Column name |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse2005 get_table_columns(db_branch_name, table_name)
Get the columns
Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their full dot-separated path (flattened).
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
try:
# Get the columns
api_response = api_instance.get_table_columns(db_branch_name, table_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling TableApi->get_table_columns: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse2004 get_table_schema(db_branch_name, table_name)
Get table schema
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
try:
# Get table schema
api_response = api_instance.get_table_schema(db_branch_name, table_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling TableApi->get_table_schema: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
set_table_schema(db_branch_name, table_name, body=body)
Update table schema
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
body = XataClient.TableNameSchemaBody() # TableNameSchemaBody | (optional)
try:
# Update table schema
api_instance.set_table_schema(db_branch_name, table_name, body=body)
except ApiException as e:
print("Exception when calling TableApi->set_table_schema: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name | |
body | TableNameSchemaBody | [optional] |
void (empty response body)
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse2006 update_column(db_branch_name, table_name, column_name, body=body)
Updates a column
Update column with partial data. Can be used for renaming the column by providing a new "name" field. To refer to sub-objects, the column name can contain dots. For example address.country
.
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
column_name = XataClient.ColumnName() # ColumnName | The Column name
body = XataClient.ColumnsColumnNameBody() # ColumnsColumnNameBody | (optional)
try:
# Updates a column
api_response = api_instance.update_column(db_branch_name, table_name, column_name, body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling TableApi->update_column: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name | |
column_name | ColumnName | The Column name | |
body | ColumnsColumnNameBody | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
update_table(db_branch_name, table_name, body=body)
Update table
Update table. Currently there is only one update operation supported: renaming the table by providing a new name. In the example below, we rename a table from “users� to “people�: jsx PATCH /db/test:main/tables/users { \"name\": \"people\" }
from __future__ import print_function
import time
import XataClient
from XataClient.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = XataClient.TableApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`.
table_name = XataClient.TableName() # TableName | The Table name
body = XataClient.TablesTableNameBody() # TablesTableNameBody | (optional)
try:
# Update table
api_instance.update_table(db_branch_name, table_name, body=body)
except ApiException as e:
print("Exception when calling TableApi->update_table: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
db_branch_name | DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | |
table_name | TableName | The Table name | |
body | TablesTableNameBody | [optional] |
void (empty response body)
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]