Schema Management
Schema
The OmixAtlas class contains functions to enable users to interact with the schema of a particular OmixAtlas Functions for visualizing, updating and inserting schema is released. Updating and inseting schema is allowed for users who have data-admin credentials only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
token copy from polly. |
required |
Usage
from polly.OmixAtlas import OmixAtlas omixatlas = OmixAtlas(token)
get_schema(repo_key, schema_level=[], source='', data_type='', return_type='dataframe')
Function to get the Schema of all the tables in an OmixAtlas. Any user can get the schema of an OmixAtlas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_id OR repo_name. This is a mandatory field. |
required |
schema_level |
list
|
Table name for which users want to get the schema. Users can get the table names by querying |
[]
|
source |
str
|
Source for which user wants to fetch the schema. |
''
|
data_type |
str
|
Datatype for which user wants to fetch the schema. |
''
|
return_type |
str
|
For users who intend to query should use "dataframe" output. |
'dataframe'
|
Raises:
Type | Description |
---|---|
paramException
|
When Function Parameter passed are not in the right format. |
RequestException
|
There is some issue in fetching the Schema |
invalidApiResponseException
|
The Data returned is not in appropriate format |
Returns:
Type | Description |
---|---|
dict
|
dict, dataframe: It will contain the schema for specific table names as dict or dataframe depending on return_type |
insert_schema(repo_key, body)
This function is used to insert the Schema in a newly created OmixAtlas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_id OR repo_name of the OmixAtlas. Users can get this by running get_all_omixatlas function. |
required |
body |
dict
|
The payload should be a JSON file for a specific table as per the structure defined for schema. |
required |
Raises:
Type | Description |
---|---|
apiErrorException
|
Some Issue in Inserting the Schema for the OmixAtlas. |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dict containing the New Schema |
replace_schema(repo_key, body)
Replace the same for an Omixatlas. The function will replace the existing source and datatype dictionary if new source and datatype dictionaries are passed
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_id OR repo_name of the OmixAtlas. Users can get this by running get_all_omixatlas function. |
required |
body |
dict
|
The payload should be a JSON file for a specific table as per the structure defined for schema. |
required |
Raises:
Type | Description |
---|---|
apiErrorException
|
Some Issue in Replacing the Schema for the OmixAtlas. |
paramException
|
Parameter Functions are not passed correctly. |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
returns the replaced schema |
update_schema(repo_key, body)
Update Schema for an existing OmixAtlas
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_id OR repo_name of the OmixAtlas. Users can get this by running get_all_omixatlas function. |
required |
body |
dict
|
The payload should be a JSON file for a specific table as per the structure defined for schema. |
required |
Raises:
Type | Description |
---|---|
apiErrorException
|
Some Issue in Inserting the Schema for the OmixAtlas. |
paramException
|
Parameter Functions are not passed correctly. |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dict containing the updated Schema |