Skip to content

Taycode/xata-python-sdk

Repository files navigation

swagger-client

xata.io API

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import XataClient 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import XataClient

Getting Started

Please follow the installation procedure and then run the following:

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.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 
body = XataClient.DbDbBranchNameBody() # DbDbBranchNameBody |  (optional)
_from = '_from_example' # str | Name of source branch to branch the new schema from (optional)

try:
    # Create Database branch
    api_instance.create_branch(db_branch_name, body=body, _from=_from)
except ApiException as e:
    print("Exception when calling BranchApi->create_branch: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 

try:
    # Delete Database branch
    api_instance.delete_branch(db_branch_name)
except ApiException as e:
    print("Exception when calling BranchApi->delete_branch: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 
body = XataClient.MigrationsExecuteBody() # MigrationsExecuteBody |  (optional)

try:
    # Migrate branch
    api_instance.execute_branch_migration_plan(db_branch_name, body=body)
except ApiException as e:
    print("Exception when calling BranchApi->execute_branch_migration_plan: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 

try:
    # Get branch schema and metadata
    api_response = api_instance.get_branch_details(db_branch_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BranchApi->get_branch_details: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_name = XataClient.DBName() # DBName | The Database Name

try:
    # List branches
    api_response = api_instance.get_branch_list(db_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BranchApi->get_branch_list: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 

try:
    # Get Branch Metadata
    api_response = api_instance.get_branch_metadata(db_branch_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BranchApi->get_branch_metadata: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 

try:
    # Get branch migration history
    api_response = api_instance.get_branch_migration_history(db_branch_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BranchApi->get_branch_migration_history: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 
body = XataClient.Schema() # Schema |  (optional)

try:
    # Compute migration plan
    api_response = api_instance.get_branch_migration_plan(db_branch_name, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BranchApi->get_branch_migration_plan: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 

try:
    # Branch stats
    api_response = api_instance.get_branch_stats(db_branch_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BranchApi->get_branch_stats: %s\n" % e)


# create an instance of the API class
api_instance = XataClient.BranchApi(XataClient.ApiClient(configuration))
db_branch_name = XataClient.DBBranchName() # DBBranchName | The DBBranchName matches the pattern `{db_name}:{branch_name}`. 
body = XataClient.BranchMetadata() # BranchMetadata |  (optional)

try:
    # Update branch metadata
    api_instance.update_branch_metadata(db_branch_name, body=body)
except ApiException as e:
    print("Exception when calling BranchApi->update_branch_metadata: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
BranchApi create_branch PUT /db/{db_branch_name} Create Database branch
BranchApi delete_branch DELETE /db/{db_branch_name} Delete Database branch
BranchApi execute_branch_migration_plan POST /db/{db_branch_name}/migrations/execute Migrate branch
BranchApi get_branch_details GET /db/{db_branch_name} Get branch schema and metadata
BranchApi get_branch_list GET /dbs/{db_name} List branches
BranchApi get_branch_metadata GET /db/{db_branch_name}/metadata Get Branch Metadata
BranchApi get_branch_migration_history GET /db/{db_branch_name}/migrations Get branch migration history
BranchApi get_branch_migration_plan POST /db/{db_branch_name}/migrations/plan Compute migration plan
BranchApi get_branch_stats GET /db/{db_branch_name}/stats Branch stats
BranchApi update_branch_metadata PUT /db/{db_branch_name}/metadata Update branch metadata
DatabaseApi create_database PUT /dbs/{db_name} Create Database
DatabaseApi delete_database DELETE /dbs/{db_name} Delete Database
DatabaseApi get_database_list GET /dbs List databases
RecordsApi bulk_insert_table_records POST /db/{db_branch_name}/tables/{table_name}/bulk Bulk insert records
RecordsApi delete_record DELETE /db/{db_branch_name}/tables/{table_name}/data/{record_id} Delete record from table
RecordsApi get_record GET /db/{db_branch_name}/tables/{table_name}/data/{record_id} Get record by ID
RecordsApi insert_record POST /db/{db_branch_name}/tables/{table_name}/data Insert record
RecordsApi insert_record_with_id PUT /db/{db_branch_name}/tables/{table_name}/data/{record_id} Insert record with ID
RecordsApi query_table POST /db/{db_branch_name}/tables/{table_name}/query Query table
RecordsApi search_branch POST /db/{db_branch_name}/search Free text search
RecordsApi update_record_with_id PATCH /db/{db_branch_name}/tables/{table_name}/data/{record_id} Update record with ID
RecordsApi upsert_record_with_id POST /db/{db_branch_name}/tables/{table_name}/data/{record_id} Upsert record with ID
TableApi add_table_column POST /db/{db_branch_name}/tables/{table_name}/columns Creates a new column
TableApi create_table PUT /db/{db_branch_name}/tables/{table_name} Create table
TableApi delete_column DELETE /db/{db_branch_name}/tables/{table_name}/columns/{column_name} Deletes a column
TableApi delete_table DELETE /db/{db_branch_name}/tables/{table_name} Delete table
TableApi get_column GET /db/{db_branch_name}/tables/{table_name}/columns/{column_name} Get column information
TableApi get_table_columns GET /db/{db_branch_name}/tables/{table_name}/columns Get the columns
TableApi get_table_schema GET /db/{db_branch_name}/tables/{table_name}/schema Get table schema
TableApi set_table_schema PUT /db/{db_branch_name}/tables/{table_name}/schema Update table schema
TableApi update_column PATCH /db/{db_branch_name}/tables/{table_name}/columns/{column_name} Updates a column
TableApi update_table PATCH /db/{db_branch_name}/tables/{table_name} Update table
UsersApi create_user_api_key POST /user/keys/{key_name} Create and return new API key
UsersApi delete_user DELETE /user Delete user
UsersApi delete_user_api_key DELETE /user/keys/{key_name} Delete an existing API key
UsersApi get_user GET /user Get user details
UsersApi get_user_api_keys GET /user/keys Get the list of user API keys
UsersApi update_user PUT /user Update user info
WorkspacesApi accept_workspace_member_invite POST /workspaces/{workspace_id}/invites/{invite_key}/accept Accept the invitation to join a workspace
WorkspacesApi cancel_workspace_member_invite DELETE /workspaces/{workspace_id}/invites/{invite_id} Deletes an invite
WorkspacesApi create_workspace POST /workspaces Create a new workspace
WorkspacesApi delete_workspace DELETE /workspaces/{workspace_id} Delete an existing workspace
WorkspacesApi get_workspace GET /workspaces/{workspace_id} Get an existing workspace
WorkspacesApi get_workspace_members_list GET /workspaces/{workspace_id}/members Get the list members of a workspace
WorkspacesApi get_workspaces_list GET /workspaces Get workspaces
WorkspacesApi invite_workspace_member POST /workspaces/{workspace_id}/invites Invite a user to join the workspace
WorkspacesApi remove_workspace_member DELETE /workspaces/{workspace_id}/members/{user_id} Remove a member from the workspace
WorkspacesApi resend_workspace_member_invite POST /workspaces/{workspace_id}/invites/{invite_id}/resend Resend Invite notification
WorkspacesApi update_workspace PUT /workspaces/{workspace_id} Update an existing workspace
WorkspacesApi update_workspace_member_role PUT /workspaces/{workspace_id}/members/{user_id} Update workspace member role

Documentation For Models

Documentation For Authorization

bearerAuth

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published