Civis API Python Client¶
The Civis API Python client is a Python package that helps analysts and developers interact with the Civis Platform. The package includes a set of tools around common workflows as well as a convenient interface to make requests directly to the Civis API.
Installation¶
The recommended install method is pip:
pip install civis
Alternatively, you may clone the code from github and build from source:
git clone https://github.com/civisanalytics/civis-python.git
cd civis-python
python setup.py install
The client has a soft dependency on pandas
to support features such as
data type parsing. If you are using the io
namespace to read or write
data from Civis, it is highly recommended that you install pandas
and
set use_pandas=True
in functions that accept that parameter. To install
pandas
:
pip install pandas
Authentication¶
In order to make requests to the Civis API, you will need an API key that is
unique to you. Instructions for creating a new key are found here:
https://civis.zendesk.com/hc/en-us/articles/216341583-Generating-an-API-Key.
By default, the Python client will look for your key in the environment
variable CIVIS_API_KEY
. To add the API key to your environment, copy
the key you generated to your clipboard and follow the instructions below
for your operating system.
Mac
Open .bash_profile
in TextEdit:
cd ~/
touch .bash_profile
open -e .bash_profile
Then add the following line, replacing api_key_here
with your key:
export CIVIS_API_KEY="api_key_here"
Linux
Open .bash_profile
in your favorite editor (nano is used here):
cd ~/
nano .bash_profile
Then add the following line, replacing api_key_here
with your key:
export CIVIS_API_KEY="api_key_here"
User Guide¶
For a more detailed walkthrough, see the User Guide.
Client API Reference¶
User Guide¶
Getting Started¶
After installing the Civis API Python client and setting up your API key, you
can now import the package civis
:
>>> import civis
There are two entrypoints for working with the Civis API. The first is
the civis
namespace, which contains tools for typical workflows in a user
friendly manner. For example, you may want to perform some transformation on
your data in Python that might be tricky to code in SQL. This code downloads
data from Civis, calculates the correlation between all the columns and then
uploads the data back into Civis:
>>> df = civis.io.read_civis(table="my_schema.my_table",
... database="database",
... use_pandas=True)
>>> correlation_matrix = df.corr()
>>> correlation_matrix["corr_var"] = correlation_matrix.index
>>> fut = civis.io.dataframe_to_civis(df=correlation_matrix,
... database="database",
... table="my_schema.my_correlations")
>>> fut.result()
Civis Futures¶
In the code above, dataframe_to_civis()
returns a special
CivisFuture
object. Making a request to the Civis
API usually results in a long running job. To account for this, various
functions in the civis
namespace return a
CivisFuture
to allow you to
process multiple long running jobs simultaneously. For instance, you may
want to start many jobs in parallel and wait for them all to finish rather
than wait for each job to finish before starting the next one.
The CivisFuture
follows the
concurrent.futures.Future
API fairly closely. For example,
calling result()
on fut
above forces the program to wait for the
job started with dataframe_to_civis()
to finish and
returns the result.
Working Directly with the Client¶
Although many common workflows are included in the Civis API Python client,
projects often require direct calls to the Civis API. For convenience,
the Civis API Python client implements an APIClient
object
to make these API calls with Python syntax rather than a manually crafted HTTP
request. To make a call, first instantiate an APIClient
object:
>>> client = civis.APIClient()
Note
Creating an instance of APIClient
makes an HTTP request to
determine the functions to attach to the object. You must have an
API key and internet connection to create an APIClient
object. By default, the functions attached to the object come from a base
set of Civis API endpoints. Based on your user profile, you may have access
to a set of developmental endpoints. To access these, instantiate the
client with client = civis.APIClient(resources='all')
.
With the client object instantiated, you can now make API requests like listing your user information:
>>> client.users.list_me()
{'email': 'user@email.com',
'feature_flags': {'left_nav_basic': True,
'results': True,
'scripts_notify': True,
'table_person_matching': True},
'id': 1,
'initials': 'UN',
'name': 'User Name',
'username': 'uname'}
Suppose we did not have the civis.io
namespace. This is how we might export
a CSV file from Civis. As you will see, this can be quite involved and the
civis
namespace entrypoint should be preferred whenever possible.
First, we get the ID for our database then we get the default credential for the current user.
>>> db_id = client.get_database_id('cluster-name')
>>> cred_id = client.default_credential
In order to export a table, we need to write some SQL that will generate the data to export. Then we create the export job and run it.
>>> generate_table = "select * from schema.tablename"
>>> export_job = client.scripts.post_sql(name="our export job",
remote_host_id=db_id,
credential_id=cred_id,
sql=generate_table)
>>> export_run = client.scripts.post_sql_runs(export_job.id)
We can then poll and wait for the export to be completed.
>>> import time
>>> export_state = client.scripts.get_sql_runs(export_job.id,
... export_run.id)
>>> while export_state.state in ['queued', 'running']:
... time.sleep(60)
... export_state = client.scripts.get_sql_runs(export_job.id,
... export_run.id)
Now, we can get the URL of the exported csv. First, we grab the result of our export job.
>>> export_result = client.scripts.get_sql_runs(export_job.id,
... export_run.id)
In the future, a script may export multiple jobs, so the output of this is a list.
The path returned will have a gzipped csv file, which we could load, for example, with pandas.
>>> url = export_result.output[0].path
Data Import and Export¶
The civis.io
namespace provides several functions for moving data in and
out of Civis.
Tables¶
Often, your data will be in structured format like a table in a relational database, a CSV or a dataframe. The following functions handle moving structured data to and from Civis. When using these functions, it is recommended to have pandas installed and to pass use_pandas=True in the appropriate functions. If pandas is not installed, data returned from Civis will all be treated as strings.
civis_to_csv (filename, sql, database[, ...]) |
Export data from Civis to a local CSV file. |
csv_to_civis (filename, database, table[, ...]) |
Upload the contents of a local CSV file to Civis. |
dataframe_to_civis (df, database, table[, ...]) |
Upload a pandas DataFrame into a Civis table. |
read_civis (table, database[, columns, ...]) |
Read data from a Civis table. |
read_civis_sql (sql, database[, use_pandas, ...]) |
Read data from Civis using a custom SQL string. |
Files¶
These functions will pass flat files to and from Civis. This is useful if you have data stored in binary or JSON format. Any type of file can be stored in platform via the files endpoint.
civis_to_file (file_id, buf[, api_key, client]) |
Download a file from Civis. |
file_to_civis (buf, name[, api_key, client]) |
Upload a file to Civis. |
Databases¶
These functions move data from one database to another and expose an interface
to run SQL in the database. Use query_civis()
when you need to
execute SQL that does not return data (for example, a GRANT
or
DROP TABLE
statement).
transfer_table (source_db, dest_db, ...[, ...]) |
Transfer a table from one location to another. |
query_civis (sql, database[, api_key, ...]) |
Execute a SQL statement as a Civis query. |
API Client¶
APIClient
is a class for handling requests to the Civis API.
An instantiated APIClient
contains a set of resources
(listed below) where each resource is an object with methods. By convention,
an instantiated APIClient
object is named client
and API
requests are made with the following syntax:
client = civis.APIClient()
response = client.resource.method(params)
-
class
civis.
APIClient
(api_key=None, return_type='snake', retry_total=6, api_version='1.0', resources='base')¶ The Civis API client.
Parameters: api_key : str, optional
Your API key obtained from the Civis Platform. If not given, the client will use the
CIVIS_API_KEY
environment variable.return_type : str, optional
The following types are implemented:
'raw'
Returns the rawrequests.Response
object.'snake'
Returns acivis.response.Response
object for the json-encoded content of a response. This maps the top-level json keys to snake_case.'pandas'
Returns apandas.DataFrame
for list-like responses and apandas.Series
for single a json response.
retry_total : int, optional
A number indicating the maximum number of retries for 429, 502, 503, or 504 errors.
api_version : string, optional
The version of endpoints to call. May instantiate multiple client objects with different versions. Currently only “1.0” is supported.
resources : string, optional
When set to “base”, only the default endpoints will be exposed in the client object. Set to “all” to include all endpoints available for a given user, including those that may be in development and subject to breaking changes at a later date.
Attributes
credentials An instance of the Credentials
endpointdatabases An instance of the Databases
endpointfiles An instance of the Files
endpointimports An instance of the Imports
endpointjobs An instance of the Jobs
endpointmodels An instance of the Models
endpointpredictions An instance of the Predictions
endpointprojects An instance of the Projects
endpointqueries An instance of the Queries
endpointreports An instance of the Reports
endpointscripts An instance of the Scripts
endpointtables An instance of the Tables
endpointusers An instance of the Users
endpoint-
default_credential
¶ The current user’s default credential.
-
get_aws_credential_id
(cred_name, owner=None)¶ Find an AWS credential ID.
Parameters: cred_name : str or int
If an integer ID is given, this passes through directly. If a str is given, return the ID corresponding to the AWS credential with that name.
owner : str, optional
Return the credential with this owner. If not provided, search for credentials under your username to disambiguate multiple credentials with the same name. Note that this function cannot return credentials which are not associated with an owner.
Returns: aws_credential_id : int
The ID number of the AWS credentials.
Raises: ValueError
If the AWS credential can’t be found.
Examples
>>> import civis >>> client = civis.APIClient() >>> client.get_aws_credential_id('jsmith') 1234
>>> client.get_aws_credential_id(1111) 1111
>>> client.get_aws_credential_id('shared-cred', ... owner='research-group') 99
-
get_database_credential_id
(username, database_name)¶ Return the credential ID for a given username in a given database.
Parameters: username : str or int
If an integer ID is given, this passes through directly. If a str is given, return the ID corresponding to the database credential with that username.
database_name : str or int
Return the ID of the database credential with username username for this database name or ID.
Returns: database_credential_id : int
The ID of the database credentials.
Raises: ValueError
If the credential can’t be found.
Examples
>>> import civis >>> client = civis.APIClient() >>> client.get_database_credential_id('jsmith', 'redshift-general') 1234
>>> client.get_database_credential_id(1111, 'redshift-general') 1111
-
get_database_id
(database)¶ Return the database ID for a given database name.
Parameters: database : str or int
If an integer ID is given, passes through. If a str is given the database ID corresponding to that database name is returned.
Returns: database_id : int
The ID of the database.
Raises: ValueError
If the database can’t be found.
-
get_table_id
(table, database)¶ Return the table ID for a given database and table name.
Parameters: table : str
The name of the table in format schema.table.
database : str or int
The name or ID of the database.
Returns: table_id : int
The ID of the table. Only returns exact match to specified table.
Raises: ValueError
If an exact table match can’t be found.
-
username
¶ The current user’s username.
API Response Types¶
-
class
civis.response.
Response
(json_data, snake_case=True, headers=None)¶ Custom Civis response object.
Notes
The main features of this class are that it maps camelCase to snake_case at the top level of the json object and attaches keys as attributes. Nested object keys are not changed.
Attributes
json_data (dict | None) This is json_data as it is originally returned to the user without the key names being changed. See Notes. None is used if the original response returned a 204 No Content response. headers (dict) This is the header for the API call without changing the key names. calls_remaining (int) Number of API calls remaining before rate limit is reached. rate_limit (int) Total number of calls per API rate limit period.
-
class
civis.response.
PaginatedResponse
(path, initial_params, endpoint)¶ A response object that supports iteration.
Parameters: path : str
Make GET requests to this path.
initial_params : dict
Query params that should be passed along with each request. Note that if initial_params contains the keys page_num or limit, they will be ignored. The given dict is not modified.
endpoint : civis.base.Endpoint
An endpoint used to make API requests.
Notes
This response is returned automatically by endpoints which support pagination when the iterator kwarg is specified.
Examples
>>> client = civis.APIClient() >>> queries = client.queries.list(iterator=True) >>> for query in queries: ... print(query['id'])
-
class
civis.polling.
PollableResult
(poller, poller_args, polling_interval=None, api_key=None, client=None, poll_on_creation=True)¶ Bases:
civis.base.CivisAsyncResultBase
A class for tracking pollable results.
This class will begin polling immediately upon creation, and poll for job completion once every polling_interval seconds until the job completes in Civis.
Parameters: poller : func
A function which returns an object that has a
state
attribute.poller_args : tuple
The arguments with which to call the poller function.
polling_interval : int or float
The number of seconds between API requests to check whether a result is ready.
api_key : DEPRECATED str, optional
This is not used by PollableResult, but is required to match the interface from CivisAsyncResultBase.
client :
civis.APIClient
, optionalIf not provided, an
civis.APIClient
object will be created from theCIVIS_API_KEY
.poll_on_creation : bool, optional
If
True
(the default), it will poll upon callingresult()
the first time. IfFalse
, it will wait the number of seconds specified in polling_interval from object creation before polling.Examples
>>> client = civis.APIClient() >>> database_id = client.get_database_id("my_database") >>> cred_id = client.default_credential >>> sql = "SELECT 1" >>> preview_rows = 10 >>> response = client.queries.post(database_id, sql, preview_rows, >>> credential=cred_id) >>> job_id = response.id >>> >>> poller = client.queries.get >>> poller_args = (job_id, ) # (job_id, run_id) if poller requires run_id >>> polling_interval = 10 >>> poll = PollableResult(poller, poller_args, polling_interval)
API Resources¶
Credentials¶
-
class
Credentials
(session, return_type='civis')¶ Methods
get
(id)Get a credential list
(**kwargs)List credentials post
(username, type, password, **kwargs)Create or update a credential post_authenticate
(username, ...)Authenticate against a remote host post_temporary
(id, **kwargs)Generate a temporary credential for accessing S3 put
(id, username, type, password, **kwargs)Update an existing credential -
get
(id)¶ Get a credential
Parameters: id : integer
The ID of the credential.
Returns: username : string
The username for the credential.
created_at : string/time
The creation time for this credential.
remote_host_id : integer
The ID of the remote host associated with this credential.
type : string
The credential’s type.
remote_host_name : string
The name of the remote host associated with this credential.
updated_at : string/time
The last modification time for this credential.
id : integer
The ID of the credential.
description : string
A long description of the credential.
owner : string
The name of the user who this credential belongs to.
name : string
The name identifying the credential
-
list
(**kwargs)¶ List credentials
Parameters: type : string, optional
The type (or types) of credentials to return. One or more of: Amazon Web Services S3, BSD::API, CASS/NCOA PAF, Catalist::API, Catalist::SFTP, Certificate, Civis Platform, Custom, Database, Google, Github, JobTraits::Ftp, Salesforce User, Salesforce Client, Silverpop Application, Silverpop Refresh Token, Silverpop User, TableauUser, VAN::MyVoterFile, VAN::MyCampaign, and VAN::BothModes. Specify multiple values as a comma- separated list (e.g., “A,B”).
default : boolean, optional
If true, will return a list with a single credential which is the current user’s default credential.
limit : integer, optional
Number of results to return. Defaults to its maximum of 1000.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, created_at, name.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: username : string
The username for the credential.
created_at : string/time
The creation time for this credential.
remote_host_id : integer
The ID of the remote host associated with this credential.
type : string
The credential’s type.
remote_host_name : string
The name of the remote host associated with this credential.
updated_at : string/time
The last modification time for this credential.
id : integer
The ID of the credential.
description : string
A long description of the credential.
owner : string
The name of the user who this credential belongs to.
name : string
The name identifying the credential
-
post
(username, type, password, **kwargs)¶ Create or update a credential
Parameters: username : string
The username for the credential.
type : string
password : string
The password for the credential.
remote_host_id : integer, optional
The ID of the remote host associated with the credential.
description : string, optional
A long description of the credential.
remote_host : dict, optional:
- url : string The URL to your host. - type : string The type of remote host. One of: RemoteHostTypes::BSD, RemoteHostTypes::Ftp, RemoteHostTypes::Github, RemoteHostTypes::GoogleDoc, RemoteHostTypes::JDBC, RemoteHostTypes::Redshift, RemoteHostTypes::Salesforce, and RemoteHostTypes::Van - name : string The human readable name for the remote host.
name : string, optional
The name identifying the credential.
Returns: username : string
The username for the credential.
created_at : string/time
The creation time for this credential.
remote_host_id : integer
The ID of the remote host associated with this credential.
type : string
The credential’s type.
remote_host_name : string
The name of the remote host associated with this credential.
updated_at : string/time
The last modification time for this credential.
id : integer
The ID of the credential.
description : string
A long description of the credential.
owner : string
The name of the user who this credential belongs to.
name : string
The name identifying the credential
-
post_authenticate
(username, remote_host_type, password, url)¶ Authenticate against a remote host
Parameters: username : string
The username for the credential.
remote_host_type : string
The type of remote host. One of: RemoteHostTypes::BSD, RemoteHostTypes::Ftp, RemoteHostTypes::Github, RemoteHostTypes::GoogleDoc, RemoteHostTypes::JDBC, RemoteHostTypes::Redshift, RemoteHostTypes::Salesforce, and RemoteHostTypes::Van
password : string
The password for the credential.
url : string
The URL to your host.
Returns: username : string
The username for the credential.
created_at : string/time
The creation time for this credential.
remote_host_id : integer
The ID of the remote host associated with this credential.
type : string
The credential’s type.
remote_host_name : string
The name of the remote host associated with this credential.
updated_at : string/time
The last modification time for this credential.
id : integer
The ID of the credential.
description : string
A long description of the credential.
owner : string
The name of the user who this credential belongs to.
name : string
The name identifying the credential
-
post_temporary
(id, **kwargs)¶ Generate a temporary credential for accessing S3
Parameters: id : integer
The ID of the credential.
duration : integer, optional
The number of seconds the temporary credential should be valid. Defaults to 15 minutes. Must not be less than 15 minutes or greater than 36 hours.
Returns: secret_access_key : string
The secret part of the credential.
session_token : string
The session token identifier.
access_key : string
The identifier of the credential.
-
put
(id, username, type, password, **kwargs)¶ Update an existing credential
Parameters: id : integer
The ID of the credential.
username : string
The username for the credential.
type : string
password : string
The password for the credential.
remote_host_id : integer, optional
The ID of the remote host associated with the credential.
description : string, optional
A long description of the credential.
remote_host : dict, optional:
- url : string The URL to your host. - type : string The type of remote host. One of: RemoteHostTypes::BSD, RemoteHostTypes::Ftp, RemoteHostTypes::Github, RemoteHostTypes::GoogleDoc, RemoteHostTypes::JDBC, RemoteHostTypes::Redshift, RemoteHostTypes::Salesforce, and RemoteHostTypes::Van - name : string The human readable name for the remote host.
name : string, optional
The name identifying the credential.
Returns: username : string
The username for the credential.
created_at : string/time
The creation time for this credential.
remote_host_id : integer
The ID of the remote host associated with this credential.
type : string
The credential’s type.
remote_host_name : string
The name of the remote host associated with this credential.
updated_at : string/time
The last modification time for this credential.
id : integer
The ID of the credential.
description : string
A long description of the credential.
owner : string
The name of the user who this credential belongs to.
name : string
The name identifying the credential
-
Databases¶
-
class
Databases
(session, return_type='civis')¶ Methods
delete_whitelist_ips
(id, whitelisted_ip_id)Remove a whitelisted IP address get_whitelist_ips
(id, whitelisted_ip_id)View details about a whitelisted IP list
()List databases list_schemas
(id)List schemas in this database list_whitelist_ips
(id)List whitelisted IPs for the specified database post_whitelist_ips
(id, subnet_mask)Whitelist an IP address -
delete_whitelist_ips
(id, whitelisted_ip_id)¶ Remove a whitelisted IP address
Parameters: id : integer
The ID of the database this rule is applied to.
whitelisted_ip_id : integer
The ID of this whitelisted IP address.
Returns: None
Response code 204: success
-
get_whitelist_ips
(id, whitelisted_ip_id)¶ View details about a whitelisted IP
Parameters: id : integer
The ID of the database this rule is applied to.
whitelisted_ip_id : integer
The ID of this whitelisted IP address.
Returns: is_active : boolean
True if the rule is applied, false if it has been revoked.
created_at : string/time
The time this rule was created.
authorized_by : string
The user who authorized this rule.
subnet_mask : string
The subnet mask that is allowed by this rule.
security_group_id : string
The ID of the security group this rule is applied to.
remote_host_id : integer
The ID of the database this rule is applied to.
updated_at : string/time
The time this rule was last updated.
id : integer
The ID of this whitelisted IP address.
-
list
()¶ List databases
Returns: name : string
The name of the database.
id : integer
The ID for the database.
-
list_schemas
(id)¶ List schemas in this database
Parameters: id : integer
The ID of the database.
Returns: schema : string
The name of a schema.
-
list_whitelist_ips
(id)¶ List whitelisted IPs for the specified database
Parameters: id : integer
The ID for the database.
Returns: created_at : string/time
The time this rule was created.
subnet_mask : string
The subnet mask that is allowed by this rule.
security_group_id : string
The ID of the security group this rule is applied to.
remote_host_id : integer
The ID of the database this rule is applied to.
updated_at : string/time
The time this rule was last updated.
id : integer
The ID of this whitelisted IP address.
-
post_whitelist_ips
(id, subnet_mask)¶ Whitelist an IP address
Parameters: id : integer
The ID of the database this rule is applied to.
subnet_mask : string
The subnet mask that is allowed by this rule.
Returns: is_active : boolean
True if the rule is applied, false if it has been revoked.
created_at : string/time
The time this rule was created.
authorized_by : string
The user who authorized this rule.
subnet_mask : string
The subnet mask that is allowed by this rule.
security_group_id : string
The ID of the security group this rule is applied to.
remote_host_id : integer
The ID of the database this rule is applied to.
updated_at : string/time
The time this rule was last updated.
id : integer
The ID of this whitelisted IP address.
-
Files¶
-
class
Files
(session, return_type='civis')¶ Methods
delete_projects
(id, project_id)Remove a Data::S3File from a project delete_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_shares_users
(id, user_id)Revoke the permissions a user has on this object get
(id)Get details about a file list_projects
(id)List the projects a Data::S3File belongs to list_shares
(id)List users and groups permissioned on this object post
(name, **kwargs)Initiate an upload of a file into the platform put_projects
(id, project_id)Add a Data::S3File to a project put_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_shares_users
(id, user_ids, permission_level)Set the permissions users have on this object -
delete_projects
(id, project_id)¶ Remove a Data::S3File from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
get
(id)¶ Get details about a file
Parameters: id : integer
The ID of the file object.
Returns: expires_at : string/date-time
The date and time the file will expire. If not specified, the file will expire in 30 days. To keep a file indefinitely, specify null.
created_at : string/date-time
The date and time the file was created.
download_url : string
A JSON string containing information about the URL of the file.
file_size : integer
The file size.
id : integer
The ID of the file object.
file_url : string
The URL that may be used to download the file.
name : string
The file name.
-
list_projects
(id)¶ List the projects a Data::S3File belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
post
(name, **kwargs)¶ Initiate an upload of a file into the platform
Parameters: name : string
The file name.
expires_at : string/date-time, optional
The date and time the file will expire. If not specified, the file will expire in 30 days. To keep a file indefinitely, specify null.
Returns: upload_url : string
The URL that may be used to upload a file. To use the upload URL, initiate a POST request to the given URL with the file you wish to import as the “file” form field.
upload_fields : dict
A hash containing the form fields to be included with the POST request.
expires_at : string/date-time
The date and time the file will expire. If not specified, the file will expire in 30 days. To keep a file indefinitely, specify null.
created_at : string/date-time
The date and time the file was created.
file_size : integer
The file size.
id : integer
The ID of the file object.
name : string
The file name.
-
put_projects
(id, project_id)¶ Add a Data::S3File to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
Imports¶
-
class
Imports
(session, return_type='civis')¶ Methods
delete_files_runs
(id, run_id)Cancel a run delete_projects
(id, project_id)Remove a JobTypes::Import from a project delete_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_shares_users
(id, user_id)Revoke the permissions a user has on this object delete_syncs
(id, sync_id)Delete a sync get
(id)Get details about an import get_batches
(id)Get details about a batch import get_files_runs
(id, run_id)Check status of a run list
(**kwargs)List imports list_batches
(**kwargs)List batch imports list_files_runs
(id, **kwargs)List runs for the given import list_projects
(id)List the projects a JobTypes::Import belongs to list_runs
(id)Get the run history of this import list_shares
(id)List users and groups permissioned on this object post
(sync_type, name, is_outbound, **kwargs)Create a new import configuration post_batches
(credential_id, schema, ...)Upload multiple files to Redshift post_cancel
(id)Cancel a run post_files
(credential_id, remote_host_id, ...)Initate an import of a tabular file into the platform post_files_runs
(id)Start a run post_runs
(id)Run an import post_syncs
(id, destination, source, **kwargs)Create a sync put
(id, sync_type, name, is_outbound, **kwargs)Update an import put_archive
(id, status)Update the archive status of this object put_projects
(id, project_id)Add a JobTypes::Import to a project put_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_shares_users
(id, user_ids, permission_level)Set the permissions users have on this object put_syncs
(id, sync_id, destination, source, ...)Update a sync -
delete_files_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the import.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
-
delete_projects
(id, project_id)¶ Remove a JobTypes::Import from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
delete_syncs
(id, sync_id)¶ Delete a sync
Parameters: id : integer
The ID of the import to fetch.
sync_id : integer
The ID of the sync to fetch.
Returns: None
Response code 204: success
-
get
(id)¶ Get details about an import
Parameters: id : integer
The ID for the import.
Returns: created_at : string/date-time
next_run_at : string/time
The time of the next scheduled run.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
source : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
parent_id : integer
Parent id to trigger this import from
sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
destination : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
syncs : list:
List of syncs. - destination : dict:: - path : string The schema.tablename to sync to. - source : dict:: - path : string The path of the dataset to sync from; for a database source, schema.tablename. - id : integer The ID of the table or file, if available. - advanced_options : dict:: - partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string - id : integer
is_outbound : boolean
id : integer
The ID for the import.
time_zone : string
The time zone of this import.
updated_at : string/date-time
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
state : string
name : string
The name of the import.
-
get_batches
(id)¶ Get details about a batch import
Parameters: id : integer
The ID for the import.
Returns: error : string
The error returned by the run, if any.
schema : string
The destination schema name. This schema must already exist in Redshift.
started_at : string/time
The time the last run started at.
finished_at : string/time
The time the last run completed.
remote_host_id : integer
The ID of the destination database host.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
table : string
The destination table name, without the schema prefix. This table must already exist in Redshift.
state : string
The state of the run; one of “queued”, “running”, “succeeded”, “failed”, or “cancelled”.
id : integer
The ID for the import.
-
get_files_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the import.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
import_id : integer
The ID of the import.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list
(**kwargs)¶ List imports
Parameters: type : string, optional
If specified, return imports of these types. It accepts a comma-separated list, possible values are ‘AutoImport’, ‘DbSync’, ‘Salesforce’, ‘GdocImport’.
author : string, optional
If specified, return imports from this author. It accepts a comma-separated list of author ids.
destination : string, optional
If specified, returns imports with one of these destinations. It accepts a comma-separated list of remote host ids.
status : string, optional
If specified, returns imports with one of these statuses. It accepts a comma-separated list, possible values are ‘running’, ‘failed’, ‘succeeded’, ‘idle’, ‘scheduled’.
archived : string, optional
The archival status of the requested object(s).
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at, last_run.updated_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/date-time
sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
destination : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
time_zone : string
The time zone of this import.
is_outbound : boolean
id : integer
The ID for the import.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
updated_at : string/date-time
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
name : string
The name of the import.
archived : string
The archival status of the requested object(s).
state : string
source : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
-
list_batches
(**kwargs)¶ List batch imports
Parameters: limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, created_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: error : string
The error returned by the run, if any.
schema : string
The destination schema name. This schema must already exist in Redshift.
started_at : string/time
The time the last run started at.
finished_at : string/time
The time the last run completed.
remote_host_id : integer
The ID of the destination database host.
table : string
The destination table name, without the schema prefix. This table must already exist in Redshift.
state : string
The state of the run; one of “queued”, “running”, “succeeded”, “failed”, or “cancelled”.
id : integer
The ID for the import.
-
list_files_runs
(id, **kwargs)¶ List runs for the given import
Parameters: id : integer
The ID of the import.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
import_id : integer
The ID of the import.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list_projects
(id)¶ List the projects a JobTypes::Import belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_runs
(id)¶ Get the run history of this import
Parameters: id : integer
Returns: error : string
The error message for this run, if present.
created_at : string/time
The time that the run was queued.
finished_at : string/time
The time that the run completed.
started_at : string/time
The time that the run started.
state : string
id : integer
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
post
(sync_type, name, is_outbound, **kwargs)¶ Create a new import configuration
Parameters: sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
name : string
The name of the import.
is_outbound : boolean
time_zone : string, optional
The time zone of this import.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time, optional
The time of the next scheduled run.
source : dict, optional:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id.
parent_id : integer, optional
Parent id to trigger this import from
destination : dict, optional:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: created_at : string/date-time
next_run_at : string/time
The time of the next scheduled run.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
source : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
parent_id : integer
Parent id to trigger this import from
sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
destination : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
syncs : list:
List of syncs. - destination : dict:: - path : string The schema.tablename to sync to. - source : dict:: - path : string The path of the dataset to sync from; for a database source, schema.tablename. - id : integer The ID of the table or file, if available. - advanced_options : dict:: - partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string - id : integer
is_outbound : boolean
id : integer
The ID for the import.
time_zone : string
The time zone of this import.
updated_at : string/date-time
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
state : string
name : string
The name of the import.
-
post_batches
(credential_id, schema, file_ids, remote_host_id, table, **kwargs)¶ Upload multiple files to Redshift
Parameters: credential_id : integer
The ID of the credentials to be used when performing the database import.
schema : string
The destination schema name. This schema must already exist in Redshift.
file_ids : list
The file IDs for the import.
remote_host_id : integer
The ID of the destination database host.
table : string
The destination table name, without the schema prefix. This table must already exist in Redshift.
column_delimiter : string, optional
The column delimiter for the file. Valid arguments are “comma”, “tab”, and “pipe”. If unspecified, defaults to “comma”.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
first_row_is_header : boolean, optional
A boolean value indicating whether or not the first row is a header row. If unspecified, defaults to false.
compression : string, optional
The type of compression. Valid arguments are “gzip”, “zip”, and “none”. If unspecified, defaults to “gzip”.
Returns: error : string
The error returned by the run, if any.
schema : string
The destination schema name. This schema must already exist in Redshift.
started_at : string/time
The time the last run started at.
finished_at : string/time
The time the last run completed.
remote_host_id : integer
The ID of the destination database host.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
table : string
The destination table name, without the schema prefix. This table must already exist in Redshift.
state : string
The state of the run; one of “queued”, “running”, “succeeded”, “failed”, or “cancelled”.
id : integer
The ID for the import.
-
post_cancel
(id)¶ Cancel a run
Parameters: id : integer
The ID of the job.
Returns: is_cancel_requested : boolean
True if run cancel requested, else false.
state : string
The state of the run, one of ‘queued’, ‘running’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_files
(credential_id, remote_host_id, schema, name, **kwargs)¶ Initate an import of a tabular file into the platform
Parameters: credential_id : integer
The id of the credentials to be used when performing the database import.
remote_host_id : integer
The id of the destination database host.
schema : string
The schema of the destination table.
name : string
The name of the destination table.
existing_table_rows : string, optional
The behaviour if a table with the requested name already exists. One of “fail”, “truncate”, “append”, or “drop”.Defaults to “fail”.
first_row_is_header : boolean, optional
A boolean value indicating whether or not the first row is a header row. If first_row_is_header is null or omitted, it will be auto-detected.
multipart : boolean, optional
If true, the upload URI will require a multipart/form-data POST request. Defaults to false.
distkey : string, optional
The column to use as the distkey for the table.
column_delimiter : string, optional
The column delimiter of the file. If column_delimiter is null or omitted, it will be auto-detected. Valid arguments are “comma”, “tab”, and “pipe”.
max_errors : integer, optional
The maximum number of rows with errors to remove from the import before failing.
sortkey1 : string, optional
The column to use as the sort key for the table.
sortkey2 : string, optional
The second column in a compound sortkey for the table.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
Returns: upload_fields : dict
If multipart was set to true, these fields should be included in the multipart upload.
run_uri : string
The URI to POST to once the file upload is complete. After uploading the file using the URI given in the uploadUri attribute of the reponse, POST to this URI to initiate the import of your uploaded file into the platform.
upload_uri : string
The URI which may be used to upload a tabular file for import. You must use this URI to upload the file you wish imported and then inform the Civis API when your upload is complete using the URI given by the runUri field of this reponse.
id : integer
The id of the import.
-
post_files_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the import.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
import_id : integer
The ID of the import.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_runs
(id)¶ Run an import
Parameters: id : integer
The ID of the import to run.
Returns: run_id : integer
The ID of the new run triggered.
-
post_syncs
(id, destination, source, **kwargs)¶ Create a sync
Parameters: id : integer
destination : dict:
- path : string The schema.tablename to sync to.
source : dict:
- path : string The path of the dataset to sync from; for a database source, schema.tablename.
advanced_options : dict, optional:
- partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string
Returns: destination : dict:
- path : string The schema.tablename to sync to.
source : dict:
- path : string The path of the dataset to sync from; for a database source, schema.tablename. - id : integer The ID of the table or file, if available.
advanced_options : dict:
- partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string
id : integer
-
put
(id, sync_type, name, is_outbound, **kwargs)¶ Update an import
Parameters: id : integer
The ID for the import.
sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
name : string
The name of the import.
is_outbound : boolean
time_zone : string, optional
The time zone of this import.
next_run_at : string/time, optional
The time of the next scheduled run.
source : dict, optional:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id.
parent_id : integer, optional
Parent id to trigger this import from
destination : dict, optional:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: created_at : string/date-time
next_run_at : string/time
The time of the next scheduled run.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
source : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
parent_id : integer
Parent id to trigger this import from
sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
destination : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
syncs : list:
List of syncs. - destination : dict:: - path : string The schema.tablename to sync to. - source : dict:: - path : string The path of the dataset to sync from; for a database source, schema.tablename. - id : integer The ID of the table or file, if available. - advanced_options : dict:: - partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string - id : integer
is_outbound : boolean
id : integer
The ID for the import.
time_zone : string
The time zone of this import.
updated_at : string/date-time
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
state : string
name : string
The name of the import.
-
put_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: created_at : string/date-time
next_run_at : string/time
The time of the next scheduled run.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
source : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
parent_id : integer
Parent id to trigger this import from
sync_type : string
The type of sync to perform; one of Dbsync, AutoImport, SilverpopDataImport, SilverpopContactImport, GdocImport, GdocExport, and Salesforce.
destination : dict:
- credential_id : integer - remote_host_id : integer - additional_credentials : list Array that holds additional credentials used for specific imports. For salesforce imports, the first and only element is the client credential id. - name : string
syncs : list:
List of syncs. - destination : dict:: - path : string The schema.tablename to sync to. - source : dict:: - path : string The path of the dataset to sync from; for a database source, schema.tablename. - id : integer The ID of the table or file, if available. - advanced_options : dict:: - partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string - id : integer
is_outbound : boolean
id : integer
The ID for the import.
time_zone : string
The time zone of this import.
updated_at : string/date-time
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
state : string
name : string
The name of the import.
-
put_projects
(id, project_id)¶ Add a JobTypes::Import to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
put_syncs
(id, sync_id, destination, source, **kwargs)¶ Update a sync
Parameters: id : integer
The ID of the import to fetch.
sync_id : integer
The ID of the sync to fetch.
destination : dict:
- path : string The schema.tablename to sync to.
source : dict:
- path : string The path of the dataset to sync from; for a database source, schema.tablename.
advanced_options : dict, optional:
- partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string
Returns: destination : dict:
- path : string The schema.tablename to sync to.
source : dict:
- path : string The path of the dataset to sync from; for a database source, schema.tablename. - id : integer The ID of the table or file, if available.
advanced_options : dict:
- partition_table_partition_column_min_name : string - export_action : string - partition_column_name : string - verify_table_row_counts : boolean - partition_table_name : string - first_row_is_header : boolean - wipe_destination_table : boolean - truncate_long_lines : boolean - sortkey1 : string - sortkey2 : string - mysql_catalog_matches_schema : boolean - contact_lists : string - identity_column : string - partition_table_partition_column_max_name : string - sql_query : string - existing_table_rows : string - last_modified_column : string - partition_schema_name : string - invalid_char_replacement : string - distkey : string - column_delimiter : string - row_chunk_size : integer - max_errors : integer - soql_query : string
id : integer
-
Jobs¶
-
class
Jobs
(session, return_type='civis')¶ Methods
delete_projects
(id, project_id)Remove a Job from a project delete_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_shares_users
(id, user_id)Revoke the permissions a user has on this object get
(id)Show basic job info get_runs
(id, run_id)Check status of a job list
(**kwargs)List jobs list_children
(id)Show nested tree of children that this job triggers list_parents
(id)Show chain of parents as a list that this job triggers from list_projects
(id)List the projects a Job belongs to list_shares
(id)List users and groups permissioned on this object post_runs
(id)Run a job post_trigger_email
(id)Generate and retrieve trigger email address put_projects
(id, project_id)Add a Job to a project put_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_shares_users
(id, user_ids, permission_level)Set the permissions users have on this object -
delete_projects
(id, project_id)¶ Remove a Job from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
get
(id)¶ Show basic job info
Parameters: id : integer
The ID for this job.
Returns: updated_at : string/date-time
archived : string
The archival status of the requested object(s).
created_at : string/date-time
runs : list:
Information about the most recent runs of the job. - error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
id : integer
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
type : string
state : string
Whether the job is idle, queued, running, cancelled, or failed.
name : string
-
get_runs
(id, run_id)¶ Check status of a job
Parameters: id : integer
The ID of the Job.
run_id : integer
The ID of the Run.
Returns: error : string
The error message for this run, if present.
created_at : string/time
The time that the run was queued.
finished_at : string/time
The time that the run completed.
started_at : string/time
The time that the run started.
state : string
id : integer
-
list
(**kwargs)¶ List jobs
Parameters: limit : integer, optional
The maximum number of jobs to return.
state : string, optional
The job’s state. One or more of queued, running, succeeded, failed, and cancelled. Specify multiple values as a comma-separated list (e.g., “A,B”).
type : string, optional
The job’s type. Specify multiple values as a comma-separated list (e.g., “A,B”).
q : string, optional
Query string to search on the id, name, and job type
permission : string, optional
A permissions string, one of “read”, “write”, or “manage”. Lists only jobs for which the current user has that permission.
archived : string, optional
The archival status of the requested object(s).
Returns: updated_at : string/date-time
archived : string
The archival status of the requested object(s).
created_at : string/date-time
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
id : integer
type : string
state : string
Whether the job is idle, queued, running, cancelled, or failed.
name : string
-
list_children
(id)¶ Show nested tree of children that this job triggers
Parameters: id : integer
The ID for this job.
Returns: updated_at : string/date-time
created_at : string/date-time
runs : list:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
children : list
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
id : integer
type : string
state : string
name : string
-
list_parents
(id)¶ Show chain of parents as a list that this job triggers from
Parameters: id : integer
The ID for this job.
Returns: updated_at : string/date-time
archived : string
The archival status of the requested object(s).
created_at : string/date-time
runs : list:
Information about the most recent runs of the job. - error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
id : integer
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
type : string
state : string
Whether the job is idle, queued, running, cancelled, or failed.
name : string
-
list_projects
(id)¶ List the projects a Job belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
post_runs
(id)¶ Run a job
Parameters: id : integer
The ID for this job.
Returns: error : string
The error message for this run, if present.
created_at : string/time
The time that the run was queued.
finished_at : string/time
The time that the run completed.
started_at : string/time
The time that the run started.
state : string
id : integer
-
post_trigger_email
(id)¶ Generate and retrieve trigger email address
Parameters: id : integer
The ID for this job.
Returns: trigger_email : string
Email address which may be used to trigger this job to run.
-
put_projects
(id, project_id)¶ Add a Job to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
Models¶
-
class
Models
(session, return_type='civis')¶ Methods
delete_builds
(id, build_id)Cancel a build delete_projects
(id, project_id)Remove a models from a project delete_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_shares_users
(id, user_id)Revoke the permissions a user has on this object get
(id)Retrieve model configuration get_builds
(id, build_id)Check status of a build list
(**kwargs)List models list_builds
(id, **kwargs)List builds for the given model list_projects
(id)List the projects a models belongs to list_schedules
(id)Show the model build schedule list_shares
(id)List users and groups permissioned on this object list_types
()List all available model types patch
(id, **kwargs)Update model configuration post
(**kwargs)Create new configuration for a model post_builds
(id)Start a build put_archive
(id, status)Update the archive status of this object put_predictions
(id, primary_key, table_name, ...)Add a table on which to apply the predictive model put_projects
(id, project_id)Add a models to a project put_schedules
(id, schedule)Schedule the model build put_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_shares_users
(id, user_ids, permission_level)Set the permissions users have on this object -
delete_builds
(id, build_id)¶ Cancel a build
Parameters: id : integer
The ID of the model.
build_id : integer
The ID of the build.
Returns: None
Response code 202: success
-
delete_projects
(id, project_id)¶ Remove a models from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
get
(id)¶ Retrieve model configuration
Parameters: id : integer
The ID of the model.
Returns: dependent_variable_order : list
The order of dependent variables, especially useful for Ordinal Modeling.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
predictions : list:
The tables upon which the model will be applied. - limiting_sql : string A SQL WHERE clause used to scope the rows to be predicted. - schedule : dict:: - scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on - table_name : string The qualified name of the table on which to apply the predictive model. - primary_key : list The primary key or composite keys of the table being predicted. - output_table : string The qualified name of the table to be created which will contain the model's predictions. - state : string The status of the prediction. One of: "succeeded", "failed", "queued", or "running,"or "idle", if no build has been attempted. - id : integer The ID of the model to which to apply the prediction.
database_id : integer
The ID of the database holding the training set table used to build the model.
dependent_variable : string
The dependent variable of the training dataset.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
builds : list:
A list of trained models available for making predictions. - r_squared_error : number/float A key metric for continuous models. Nil for other model types. - created_at : string The time the model build was created. - roc_auc : number/float A key metric for binary, multinomial, and ordinal models. Nil for other model types. - id : integer The ID of the model build. - description : string A description of the model build. - root_mean_squared_error : number/float A key metric for continuous models. Nil for other model types. - name : string The name of the model build.
id : integer
The ID of the model.
active_build_id : integer
The ID of the current active build, the build used to score predictions.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
interaction_terms : boolean
Whether to search for interaction terms.
number_of_folds : integer
Number of folds for cross validation. Default value is 5.
archived : string
The archival status of the requested object(s).
description : string
A description of the model.
box_cox_transformation : boolean
Whether to transform data so that it assumes a normal distribution. Valid only with continuous models.
time_zone : string
The time zone of this model.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
credential_id : integer
The ID of the credential used to read the target table. Defaults to the user’s default credential.
created_at : string/date-time
The time the model was created.
parent_id : integer
The ID of the parent job that will trigger this model.
last_output_location : string
The output JSON for the last build.
primary_key : string
The unique ID (primary key) of the training dataset.
current_build_state : string
The status of the current model build. One of “succeeded”, “failed”, “queued”, or “running,”or “idle”, if no build has been attempted.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
model_name : string
The name of the model.
current_build_exception : string
Exception message, if applicable, of the current model build.
table_name : string
The qualified name of the table containing the training set from which to build the model.
model_type_id : integer
The ID of the model’s type.
excluded_columns : list
A list of columns which will be considered ineligible to be independent variables.
cross_validation_parameters : dict
Cross validation parameter grid for tree methods, e.g. {“n_estimators”: [100, 200, 500], “learning_rate”: [0.01, 0.1], “max_depth”: [2, 3]}.
limiting_sql : string
A custom SQL WHERE clause used to filter the rows used to build the model. (e.g., “id > 105”).
updated_at : string/date-time
The time the model was updated.
-
get_builds
(id, build_id)¶ Check status of a build
Parameters: id : integer
The ID of the model.
build_id : integer
The ID of the build.
Returns: created_at : string
The time the model build was created.
output_location : string
A URL representing the location of the full JSON output for the specified build.The URL link will be valid for 5 minutes.
output : string
A string representing the JSON output for the specified build. Only present when smaller than 10KB in size.
transformation_metadata : string
A string representing the full JSON output of the metadata for transformation of column names
id : integer
The ID of the model build.
error : string
The error, if any, returned by the build.
r_squared_error : number/float
A key metric for continuous models. Nil for other model types.
roc_auc : number/float
A key metric for binary, multinomial, and ordinal models. Nil for other model types.
description : string
A description of the model build.
root_mean_squared_error : number/float
A key metric for continuous models. Nil for other model types.
state : string
The state of the model build.one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
name : string
The name of the model build.
-
list
(**kwargs)¶ List models
Parameters: model_name : string, optional
If specified, will be used to filter the models returned. Substring matching is supported. (e.g., “modelName=model” will return both “model1” and “my model”).
training_table_name : string, optional
If specified, will be used to filter the models returned by the training dataset table name. Substring matching is supported. (e.g., “trainingTableName=table” will return both “table1” and “my_table”).
dependent_variable : string, optional
If specified, will be used to filter the models returned by the dependent variable column name. Substring matching is supported. (e.g., “dependentVariable=predictor” will return both “predictor” and “my predictor”).
author : string, optional
If specified, return models from this author. It accepts a comma-separated list of author ids.
status : string, optional
If specified, returns models with one of these statuses. It accepts a comma-separated list, possible values are ‘running’, ‘failed’, ‘succeeded’, ‘idle’, ‘scheduled’.
archived : string, optional
The archival status of the requested object(s).
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, model_name, created_at, name, last_run.updated_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: dependent_variable_order : list
The order of dependent variables, especially useful for Ordinal Modeling.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
predictions : list:
The tables upon which the model will be applied. - limiting_sql : string A SQL WHERE clause used to scope the rows to be predicted. - table_name : string The qualified name of the table on which to apply the predictive model. - primary_key : list The primary key or composite keys of the table being predicted. - output_table : string The qualified name of the table to be created which will contain the model's predictions. - state : string The status of the prediction. One of: "succeeded", "failed", "queued", or "running,"or "idle", if no build has been attempted. - id : integer The ID of the model to which to apply the prediction.
database_id : integer
The ID of the database holding the training set table used to build the model.
dependent_variable : string
The dependent variable of the training dataset.
builds : list:
A list of trained models available for making predictions. - r_squared_error : number/float A key metric for continuous models. Nil for other model types. - created_at : string The time the model build was created. - roc_auc : number/float A key metric for binary, multinomial, and ordinal models. Nil for other model types. - id : integer The ID of the model build. - description : string A description of the model build. - root_mean_squared_error : number/float A key metric for continuous models. Nil for other model types. - name : string The name of the model build.
id : integer
The ID of the model.
interaction_terms : boolean
Whether to search for interaction terms.
number_of_folds : integer
Number of folds for cross validation. Default value is 5.
archived : string
The archival status of the requested object(s).
description : string
A description of the model.
box_cox_transformation : boolean
Whether to transform data so that it assumes a normal distribution. Valid only with continuous models.
time_zone : string
The time zone of this model.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
credential_id : integer
The ID of the credential used to read the target table. Defaults to the user’s default credential.
created_at : string/date-time
The time the model was created.
parent_id : integer
The ID of the parent job that will trigger this model.
last_output_location : string
The output JSON for the last build.
primary_key : string
The unique ID (primary key) of the training dataset.
current_build_state : string
The status of the current model build. One of “succeeded”, “failed”, “queued”, or “running,”or “idle”, if no build has been attempted.
model_name : string
The name of the model.
current_build_exception : string
Exception message, if applicable, of the current model build.
table_name : string
The qualified name of the table containing the training set from which to build the model.
model_type_id : integer
The ID of the model’s type.
excluded_columns : list
A list of columns which will be considered ineligible to be independent variables.
cross_validation_parameters : dict
Cross validation parameter grid for tree methods, e.g. {“n_estimators”: [100, 200, 500], “learning_rate”: [0.01, 0.1], “max_depth”: [2, 3]}.
limiting_sql : string
A custom SQL WHERE clause used to filter the rows used to build the model. (e.g., “id > 105”).
updated_at : string/date-time
The time the model was updated.
-
list_builds
(id, **kwargs)¶ List builds for the given model
Parameters: id : integer
The ID of the model.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: created_at : string
The time the model build was created.
output_location : string
A URL representing the location of the full JSON output for the specified build.The URL link will be valid for 5 minutes.
output : string
A string representing the JSON output for the specified build. Only present when smaller than 10KB in size.
transformation_metadata : string
A string representing the full JSON output of the metadata for transformation of column names
id : integer
The ID of the model build.
error : string
The error, if any, returned by the build.
r_squared_error : number/float
A key metric for continuous models. Nil for other model types.
roc_auc : number/float
A key metric for binary, multinomial, and ordinal models. Nil for other model types.
description : string
A description of the model build.
root_mean_squared_error : number/float
A key metric for continuous models. Nil for other model types.
state : string
The state of the model build.one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
name : string
The name of the model build.
-
list_projects
(id)¶ List the projects a models belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_schedules
(id)¶ Show the model build schedule
Parameters: id : integer
The ID of the model associated with this schedule.
Returns: schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
id : integer
The ID of the model associated with this schedule.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_types
()¶ List all available model types
Returns: dv_type : string
The type of dependent variable predicted by the model.
fint_allowed : boolean
Whether this model type supports searching for interaction terms.
algorithm : string
The name of the algorithm used to train the model.
id : integer
The ID of the model type.
-
patch
(id, **kwargs)¶ Update model configuration
Parameters: id : integer
The ID of the model.
credential_id : integer, optional
The ID of the credential used to read the target table. Defaults to the user’s default credential.
dependent_variable_order : list, optional
The order of dependent variables, especially useful for Ordinal Modeling.
interaction_terms : boolean, optional
Whether to search for interaction terms.
parent_id : integer, optional
The ID of the parent job that will trigger this model.
database_id : integer, optional
The ID of the database holding the training set table used to build the model.
dependent_variable : string, optional
The dependent variable of the training dataset.
primary_key : string, optional
The unique ID (primary key) of the training dataset.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
model_name : string, optional
The name of the model.
active_build_id : integer, optional
The ID of the current active build, the build used to score predictions.
table_name : string, optional
The qualified name of the table containing the training set from which to build the model.
model_type_id : integer, optional
The ID of the model’s type.
number_of_folds : integer, optional
Number of folds for cross validation. Default value is 5.
excluded_columns : list, optional
A list of columns which will be considered ineligible to be independent variables.
description : string, optional
A description of the model.
cross_validation_parameters : dict, optional
Cross validation parameter grid for tree methods, e.g. {“n_estimators”: [100, 200, 500], “learning_rate”: [0.01, 0.1], “max_depth”: [2, 3]}.
box_cox_transformation : boolean, optional
Whether to transform data so that it assumes a normal distribution. Valid only with continuous models.
time_zone : string, optional
The time zone of this model.
limiting_sql : string, optional
A custom SQL WHERE clause used to filter the rows used to build the model. (e.g., “id > 105”).
Returns: None
Response code 204: success
-
post
(**kwargs)¶ Create new configuration for a model
Parameters: credential_id : integer, optional
The ID of the credential used to read the target table. Defaults to the user’s default credential.
dependent_variable_order : list, optional
The order of dependent variables, especially useful for Ordinal Modeling.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
interaction_terms : boolean, optional
Whether to search for interaction terms.
parent_id : integer, optional
The ID of the parent job that will trigger this model.
database_id : integer, optional
The ID of the database holding the training set table used to build the model.
dependent_variable : string, optional
The dependent variable of the training dataset.
primary_key : string, optional
The unique ID (primary key) of the training dataset.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
model_name : string, optional
The name of the model.
active_build_id : integer, optional
The ID of the current active build, the build used to score predictions.
table_name : string, optional
The qualified name of the table containing the training set from which to build the model.
model_type_id : integer, optional
The ID of the model’s type.
number_of_folds : integer, optional
Number of folds for cross validation. Default value is 5.
excluded_columns : list, optional
A list of columns which will be considered ineligible to be independent variables.
description : string, optional
A description of the model.
cross_validation_parameters : dict, optional
Cross validation parameter grid for tree methods, e.g. {“n_estimators”: [100, 200, 500], “learning_rate”: [0.01, 0.1], “max_depth”: [2, 3]}.
box_cox_transformation : boolean, optional
Whether to transform data so that it assumes a normal distribution. Valid only with continuous models.
time_zone : string, optional
The time zone of this model.
limiting_sql : string, optional
A custom SQL WHERE clause used to filter the rows used to build the model. (e.g., “id > 105”).
Returns: dependent_variable_order : list
The order of dependent variables, especially useful for Ordinal Modeling.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
predictions : list:
The tables upon which the model will be applied. - limiting_sql : string A SQL WHERE clause used to scope the rows to be predicted. - schedule : dict:: - scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on - table_name : string The qualified name of the table on which to apply the predictive model. - primary_key : list The primary key or composite keys of the table being predicted. - output_table : string The qualified name of the table to be created which will contain the model's predictions. - state : string The status of the prediction. One of: "succeeded", "failed", "queued", or "running,"or "idle", if no build has been attempted. - id : integer The ID of the model to which to apply the prediction.
database_id : integer
The ID of the database holding the training set table used to build the model.
dependent_variable : string
The dependent variable of the training dataset.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
builds : list:
A list of trained models available for making predictions. - r_squared_error : number/float A key metric for continuous models. Nil for other model types. - created_at : string The time the model build was created. - roc_auc : number/float A key metric for binary, multinomial, and ordinal models. Nil for other model types. - id : integer The ID of the model build. - description : string A description of the model build. - root_mean_squared_error : number/float A key metric for continuous models. Nil for other model types. - name : string The name of the model build.
id : integer
The ID of the model.
active_build_id : integer
The ID of the current active build, the build used to score predictions.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
interaction_terms : boolean
Whether to search for interaction terms.
number_of_folds : integer
Number of folds for cross validation. Default value is 5.
archived : string
The archival status of the requested object(s).
description : string
A description of the model.
box_cox_transformation : boolean
Whether to transform data so that it assumes a normal distribution. Valid only with continuous models.
time_zone : string
The time zone of this model.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
credential_id : integer
The ID of the credential used to read the target table. Defaults to the user’s default credential.
created_at : string/date-time
The time the model was created.
parent_id : integer
The ID of the parent job that will trigger this model.
last_output_location : string
The output JSON for the last build.
primary_key : string
The unique ID (primary key) of the training dataset.
current_build_state : string
The status of the current model build. One of “succeeded”, “failed”, “queued”, or “running,”or “idle”, if no build has been attempted.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
model_name : string
The name of the model.
current_build_exception : string
Exception message, if applicable, of the current model build.
table_name : string
The qualified name of the table containing the training set from which to build the model.
model_type_id : integer
The ID of the model’s type.
excluded_columns : list
A list of columns which will be considered ineligible to be independent variables.
cross_validation_parameters : dict
Cross validation parameter grid for tree methods, e.g. {“n_estimators”: [100, 200, 500], “learning_rate”: [0.01, 0.1], “max_depth”: [2, 3]}.
limiting_sql : string
A custom SQL WHERE clause used to filter the rows used to build the model. (e.g., “id > 105”).
updated_at : string/date-time
The time the model was updated.
-
post_builds
(id)¶ Start a build
Parameters: id : integer
The ID of the model.
Returns: created_at : string
The time the model build was created.
output_location : string
A URL representing the location of the full JSON output for the specified build.The URL link will be valid for 5 minutes.
output : string
A string representing the JSON output for the specified build. Only present when smaller than 10KB in size.
transformation_metadata : string
A string representing the full JSON output of the metadata for transformation of column names
id : integer
The ID of the model build.
error : string
The error, if any, returned by the build.
r_squared_error : number/float
A key metric for continuous models. Nil for other model types.
roc_auc : number/float
A key metric for binary, multinomial, and ordinal models. Nil for other model types.
description : string
A description of the model build.
root_mean_squared_error : number/float
A key metric for continuous models. Nil for other model types.
state : string
The state of the model build.one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
name : string
The name of the model build.
-
put_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: dependent_variable_order : list
The order of dependent variables, especially useful for Ordinal Modeling.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
predictions : list:
The tables upon which the model will be applied. - limiting_sql : string A SQL WHERE clause used to scope the rows to be predicted. - schedule : dict:: - scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on - table_name : string The qualified name of the table on which to apply the predictive model. - primary_key : list The primary key or composite keys of the table being predicted. - output_table : string The qualified name of the table to be created which will contain the model's predictions. - state : string The status of the prediction. One of: "succeeded", "failed", "queued", or "running,"or "idle", if no build has been attempted. - id : integer The ID of the model to which to apply the prediction.
database_id : integer
The ID of the database holding the training set table used to build the model.
dependent_variable : string
The dependent variable of the training dataset.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
builds : list:
A list of trained models available for making predictions. - r_squared_error : number/float A key metric for continuous models. Nil for other model types. - created_at : string The time the model build was created. - roc_auc : number/float A key metric for binary, multinomial, and ordinal models. Nil for other model types. - id : integer The ID of the model build. - description : string A description of the model build. - root_mean_squared_error : number/float A key metric for continuous models. Nil for other model types. - name : string The name of the model build.
id : integer
The ID of the model.
active_build_id : integer
The ID of the current active build, the build used to score predictions.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
interaction_terms : boolean
Whether to search for interaction terms.
number_of_folds : integer
Number of folds for cross validation. Default value is 5.
archived : string
The archival status of the requested object(s).
description : string
A description of the model.
box_cox_transformation : boolean
Whether to transform data so that it assumes a normal distribution. Valid only with continuous models.
time_zone : string
The time zone of this model.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
credential_id : integer
The ID of the credential used to read the target table. Defaults to the user’s default credential.
created_at : string/date-time
The time the model was created.
parent_id : integer
The ID of the parent job that will trigger this model.
last_output_location : string
The output JSON for the last build.
primary_key : string
The unique ID (primary key) of the training dataset.
current_build_state : string
The status of the current model build. One of “succeeded”, “failed”, “queued”, or “running,”or “idle”, if no build has been attempted.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
model_name : string
The name of the model.
current_build_exception : string
Exception message, if applicable, of the current model build.
table_name : string
The qualified name of the table containing the training set from which to build the model.
model_type_id : integer
The ID of the model’s type.
excluded_columns : list
A list of columns which will be considered ineligible to be independent variables.
cross_validation_parameters : dict
Cross validation parameter grid for tree methods, e.g. {“n_estimators”: [100, 200, 500], “learning_rate”: [0.01, 0.1], “max_depth”: [2, 3]}.
limiting_sql : string
A custom SQL WHERE clause used to filter the rows used to build the model. (e.g., “id > 105”).
updated_at : string/date-time
The time the model was updated.
-
put_predictions
(id, primary_key, table_name, **kwargs)¶ Add a table on which to apply the predictive model
Parameters: id : integer
The ID of the model to which to apply the prediction.
primary_key : list
The primary key or composite keys of the table being predicted.
table_name : string
The qualified name of the table on which to apply the predictive model.
limiting_sql : string, optional
A SQL WHERE clause used to scope the rows to be predicted.
output_table : string, optional
The qualified name of the table to be created which will contain the model’s predictions.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: limiting_sql : string
A SQL WHERE clause used to scope the rows to be predicted.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
table_name : string
The qualified name of the table on which to apply the predictive model.
primary_key : list
The primary key or composite keys of the table being predicted.
output_table : string
The qualified name of the table to be created which will contain the model’s predictions.
state : string
The status of the prediction. One of: “succeeded”, “failed”, “queued”, or “running,”or “idle”, if no build has been attempted.
id : integer
The ID of the model to which to apply the prediction.
-
put_projects
(id, project_id)¶ Add a models to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
put_schedules
(id, schedule)¶ Schedule the model build
Parameters: id : integer
The ID of the model associated with this schedule.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
id : integer
The ID of the model associated with this schedule.
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
Predictions¶
-
class
Predictions
(session, return_type='civis')¶ Methods
delete_runs
(id, run_id)Cancel a run get
(id)Show the specified prediction get_runs
(id, run_id)Check status of a run list
(**kwargs)List predictions list_runs
(id, **kwargs)List runs for the given prediction list_schedules
(id)Show the prediction schedule patch
(id, **kwargs)Update a prediction post_runs
(id)Start a run put_schedules
(id, **kwargs)Schedule the prediction -
delete_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the prediction.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
-
get
(id)¶ Show the specified prediction
Parameters: id : integer
The ID of the prediction.
Returns: schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
output_table_name : string
The name of the output table for this prediction.
id : integer
The ID of the prediction.
error : string
The error, if any, of the last run of this prediction.
limiting_sql : string
A SQL WHERE clause used to scope the rows to be predicted.
scored_table_id : integer
The ID of the source table for this prediction.
finished_at : string/date-time
The end time of the last run of this prediction.
model_id : integer
The ID of the model used for this prediction.
scored_table_name : string
The name of the source table for this prediction.
started_at : string/date-time
The start time of the last run of this prediction.
primary_key : list
The primary key or composite keys of the table being predicted.
state : string
The state of the last run of this prediction.
scored_tables : list:
An array of created prediction tables. - schema : string The schema of table with created predictions. - name : string The name of table with created predictions. - created_at : string/date-time The time when the table with created predictions was created. - score_stats : list:: An array of metrics on the created predictions. - histogram : list The histogram of the distribution of scores. - score_name : string The name of the score. - min_score : number/float The minimum score. - avg_score : number/float The average score. - max_score : number/float The maximum score. - id : integer The ID of the table with created predictions.
-
get_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the prediction.
run_id : integer
The ID of the run.
Returns: created_at : string/date-time
The time when the table with created predictions was created.
prediction_id : integer
The ID of the prediction.
id : integer
The ID of the prediction run.
exception : string
The exception, if any, returned by the prediction run.
score_stats : list:
An array of metrics on the created predictions. - histogram : list The histogram of the distribution of scores. - score_name : string The name of the score. - min_score : number/float The minimum score. - avg_score : number/float The average score. - max_score : number/float The maximum score.
state : string
The state of the prediction run.
name : string
The name of table created by this predictions run.
-
list
(**kwargs)¶ List predictions
Parameters: model_id : integer, optional
If specified, only return predictions associated with this model ID.
Returns: error : string
The error, if any, of the last run of this prediction.
started_at : string/date-time
The start time of the last run of this prediction.
scored_table_id : integer
The ID of the source table for this prediction.
finished_at : string/date-time
The end time of the last run of this prediction.
model_id : integer
The ID of the model used for this prediction.
scored_table_name : string
The name of the source table for this prediction.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
output_table_name : string
The name of the output table for this prediction.
state : string
The state of the last run of this prediction.
id : integer
The ID of the prediction.
-
list_runs
(id, **kwargs)¶ List runs for the given prediction
Parameters: id : integer
The ID of the prediction.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: created_at : string/date-time
The time when the table with created predictions was created.
prediction_id : integer
The ID of the prediction.
id : integer
The ID of the prediction run.
exception : string
The exception, if any, returned by the prediction run.
score_stats : list:
An array of metrics on the created predictions. - histogram : list The histogram of the distribution of scores. - score_name : string The name of the score. - min_score : number/float The minimum score. - avg_score : number/float The average score. - max_score : number/float The maximum score.
state : string
The state of the prediction run.
name : string
The name of table created by this predictions run.
-
list_schedules
(id)¶ Show the prediction schedule
Parameters: id : integer
ID of the prediction associated with this schedule.
Returns: score_on_model_build : boolean
Whether the prediction will run after a rebuild of the associated model.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
id : integer
ID of the prediction associated with this schedule.
-
patch
(id, **kwargs)¶ Update a prediction
Parameters: id : integer
The ID of the prediction.
primary_key : list, optional
The primary key or composite keys of the table being predicted.
output_table_name : string, optional
The name of the output table for this prediction.
limiting_sql : string, optional
A SQL WHERE clause used to scope the rows to be predicted.
Returns: schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
output_table_name : string
The name of the output table for this prediction.
id : integer
The ID of the prediction.
error : string
The error, if any, of the last run of this prediction.
limiting_sql : string
A SQL WHERE clause used to scope the rows to be predicted.
scored_table_id : integer
The ID of the source table for this prediction.
finished_at : string/date-time
The end time of the last run of this prediction.
model_id : integer
The ID of the model used for this prediction.
scored_table_name : string
The name of the source table for this prediction.
started_at : string/date-time
The start time of the last run of this prediction.
primary_key : list
The primary key or composite keys of the table being predicted.
state : string
The state of the last run of this prediction.
scored_tables : list:
An array of created prediction tables. - schema : string The schema of table with created predictions. - name : string The name of table with created predictions. - created_at : string/date-time The time when the table with created predictions was created. - score_stats : list:: An array of metrics on the created predictions. - histogram : list The histogram of the distribution of scores. - score_name : string The name of the score. - min_score : number/float The minimum score. - avg_score : number/float The average score. - max_score : number/float The maximum score. - id : integer The ID of the table with created predictions.
-
post_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the prediction.
Returns: created_at : string/date-time
The time when the table with created predictions was created.
prediction_id : integer
The ID of the prediction.
id : integer
The ID of the prediction run.
exception : string
The exception, if any, returned by the prediction run.
score_stats : list:
An array of metrics on the created predictions. - histogram : list The histogram of the distribution of scores. - score_name : string The name of the score. - min_score : number/float The minimum score. - avg_score : number/float The average score. - max_score : number/float The maximum score.
state : string
The state of the prediction run.
name : string
The name of table created by this predictions run.
-
put_schedules
(id, **kwargs)¶ Schedule the prediction
Parameters: id : integer
ID of the prediction associated with this schedule.
score_on_model_build : boolean, optional
Whether the prediction will run after a rebuild of the associated model.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: score_on_model_build : boolean
Whether the prediction will run after a rebuild of the associated model.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
id : integer
ID of the prediction associated with this schedule.
-
Projects¶
-
class
Projects
(session, return_type='civis')¶ Methods
delete_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_shares_users
(id, user_id)Revoke the permissions a user has on this object get
(project_id)Get a detailed view of a project and the objects in it list
(**kwargs)List projects list_shares
(id)List users and groups permissioned on this object post
(description, name, **kwargs)Create a project put
(project_id, **kwargs)Update a project put_archive
(id, status)Update the archive status of this object put_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_shares_users
(id, user_ids, permission_level)Set the permissions users have on this object Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
get
(project_id)¶ Get a detailed view of a project and the objects in it
Parameters: project_id : integer
Returns: hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
script_templates : list:
- name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
scripts : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
created_at : string/time
all_objects : list:
- object_type : string - icon : string - author : string - project_id : integer - object_id : integer - sub_type : string - archived : string The archival status of the requested object(s). - fco_type : string - name : string
imports : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
note : string
reports : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
id : integer
The ID for this project.
models : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
surveys : list:
- created_at : string/time - updated_at : string/time - id : integer The object ID.
files : list:
- file_size : integer - file_name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
tables : list:
- schema : string - created_at : string/time - column_count : integer - row_count : integer - updated_at : string/time - name : string
app_instances : list:
- slug : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
archived : string
The archival status of the requested object(s).
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list
(**kwargs)¶ List projects
Parameters: author : string, optional
If specified, return projects owned by this author. It accepts a comma- separated list of author ids.
permission : string, optional
A permissions string, one of “read”, “write”, or “manage”. Lists only projects for which the current user has that permission.
archived : string, optional
The archival status of the requested object(s).
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 1000.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
post
(description, name, **kwargs)¶ Create a project
Parameters: description : string
A description of the project
name : string
The name of this project.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
note : string, optional
Notes for the project
Returns: hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
script_templates : list:
- name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
scripts : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
created_at : string/time
all_objects : list:
- object_type : string - icon : string - author : string - project_id : integer - object_id : integer - sub_type : string - archived : string The archival status of the requested object(s). - fco_type : string - name : string
imports : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
note : string
reports : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
id : integer
The ID for this project.
models : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
surveys : list:
- created_at : string/time - updated_at : string/time - id : integer The object ID.
files : list:
- file_size : integer - file_name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
tables : list:
- schema : string - created_at : string/time - column_count : integer - row_count : integer - updated_at : string/time - name : string
app_instances : list:
- slug : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
archived : string
The archival status of the requested object(s).
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
put
(project_id, **kwargs)¶ Update a project
Parameters: project_id : integer
description : string, optional
A description of the project
note : string, optional
Notes for the project
name : string, optional
The name of this project.
Returns: hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
script_templates : list:
- name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
scripts : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
created_at : string/time
all_objects : list:
- object_type : string - icon : string - author : string - project_id : integer - object_id : integer - sub_type : string - archived : string The archival status of the requested object(s). - fco_type : string - name : string
imports : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
note : string
reports : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
id : integer
The ID for this project.
models : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
surveys : list:
- created_at : string/time - updated_at : string/time - id : integer The object ID.
files : list:
- file_size : integer - file_name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
tables : list:
- schema : string - created_at : string/time - column_count : integer - row_count : integer - updated_at : string/time - name : string
app_instances : list:
- slug : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
archived : string
The archival status of the requested object(s).
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
put_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
script_templates : list:
- name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
scripts : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
created_at : string/time
all_objects : list:
- object_type : string - icon : string - author : string - project_id : integer - object_id : integer - sub_type : string - archived : string The archival status of the requested object(s). - fco_type : string - name : string
imports : list:
- state : string - type : string - finished_at : string/time - created_at : string/time - id : integer The object ID. - updated_at : string/time - name : string
note : string
reports : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
id : integer
The ID for this project.
models : list:
- state : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
surveys : list:
- created_at : string/time - updated_at : string/time - id : integer The object ID.
files : list:
- file_size : integer - file_name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
tables : list:
- schema : string - created_at : string/time - column_count : integer - row_count : integer - updated_at : string/time - name : string
app_instances : list:
- slug : string - name : string - created_at : string/time - updated_at : string/time - id : integer The object ID.
archived : string
The archival status of the requested object(s).
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Queries¶
-
class
Queries
(session, return_type='civis')¶ Methods
delete_runs
(id, run_id)Cancel a run get
(id)Get details about a query get_runs
(id, run_id)Check status of a run list
(**kwargs)List all queries list_runs
(id, **kwargs)List runs for the given query post
(preview_rows, database, sql, **kwargs)Execute a query post_runs
(id)Start a run put_scripts
(id, script_id)Update the query’s associated script -
delete_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the query.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
-
get
(id)¶ Get details about a query
Parameters: id : integer
The query ID.
Returns: started_at : string/date-time
The start time of the last run.
created_at : string/time
script_id : integer
The ID of the script associated with this query.
credential : integer
The credential ID.
result_columns : list
A preview of columns returned by the query.
report_id : integer
The ID of the report associated with this query.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
result_rows : list
A preview of rows returned by the query.
id : integer
The query ID.
state : string
The state of the last run.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
sql : string
The SQL to execute.
finished_at : string/date-time
The end time of the last run.
last_run_id : integer
The ID of the last run.
exception : string
Exception returned from the query, null if the query was a success.
database : integer
The database ID.
updated_at : string/time
name : string
The name of the query.
-
get_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the query.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
query_id : integer
The ID of the query.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list
(**kwargs)¶ List all queries
Parameters: database_id : integer, optional
The database ID.
author_id : integer, optional
The author of the query.
created_before : string, optional
An upper bound for the creation date of the query.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: preview_rows : integer
The number of rows to save from the query’s result (maximum: 100).
started_at : string/date-time
The start time of the last run.
created_at : string/time
script_id : integer
The ID of the script associated with this query.
credential : integer
The credential ID.
result_columns : list
A preview of columns returned by the query.
report_id : integer
The ID of the report associated with this query.
result_rows : list
A preview of rows returned by the query.
id : integer
The query ID.
state : string
The state of the last run.
sql : string
The SQL to execute.
finished_at : string/date-time
The end time of the last run.
last_run_id : integer
The ID of the last run.
exception : string
Exception returned from the query, null if the query was a success.
database : integer
The database ID.
updated_at : string/time
-
list_runs
(id, **kwargs)¶ List runs for the given query
Parameters: id : integer
The ID of the query.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
query_id : integer
The ID of the query.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
post
(preview_rows, database, sql, **kwargs)¶ Execute a query
Parameters: preview_rows : integer
The number of rows to save from the query’s result (maximum: 100).
database : integer
The database ID.
sql : string
The SQL to execute.
interactive : boolean, optional
Deprecated and not used.
filename_prefix : string, optional
The output filename prefix.
column_delimiter : string, optional
The delimiter to use. One of comma or tab, or pipe [default: comma].
include_header : boolean, optional
Whether the CSV output should include a header row [default: true].
credential : integer, optional
The credential ID.
unquoted : boolean, optional
If true, will not quote fields.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
compression : string, optional
The type of compression. One of gzip or zip, or none [default: gzip].
Returns: interactive : boolean
Deprecated and not used.
updated_at : string/time
report_id : integer
The ID of the report associated with this query.
result_rows : list
A preview of rows returned by the query.
id : integer
The query ID.
finished_at : string/date-time
The end time of the last run.
exception : string
Exception returned from the query, null if the query was a success.
database : integer
The database ID.
created_at : string/time
script_id : integer
The ID of the script associated with this query.
include_header : boolean
Whether the CSV output should include a header row [default: true].
preview_rows : integer
The number of rows to save from the query’s result (maximum: 100).
result_columns : list
A preview of columns returned by the query.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
credential : integer
The credential ID.
sql : string
The SQL to execute.
column_delimiter : string
The delimiter to use. One of comma or tab, or pipe [default: comma].
unquoted : boolean
If true, will not quote fields.
filename_prefix : string
The output filename prefix.
last_run_id : integer
The ID of the last run.
started_at : string/date-time
The start time of the last run.
state : string
The state of the last run.
compression : string
The type of compression. One of gzip or zip, or none [default: gzip].
-
post_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the query.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
query_id : integer
The ID of the query.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
put_scripts
(id, script_id)¶ Update the query’s associated script
Parameters: id : integer
The query ID.
script_id : integer
The ID of the script associated with this query.
Returns: started_at : string/date-time
The start time of the last run.
created_at : string/time
script_id : integer
The ID of the script associated with this query.
credential : integer
The credential ID.
result_columns : list
A preview of columns returned by the query.
report_id : integer
The ID of the report associated with this query.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
result_rows : list
A preview of rows returned by the query.
id : integer
The query ID.
state : string
The state of the last run.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
sql : string
The SQL to execute.
finished_at : string/date-time
The end time of the last run.
last_run_id : integer
The ID of the last run.
exception : string
Exception returned from the query, null if the query was a success.
database : integer
The database ID.
updated_at : string/time
name : string
The name of the query.
-
Reports¶
-
class
Reports
(session, return_type='civis')¶ Methods
delete_grants
(id)Revoke permisstion for this report to perform Civis platform API operations on delete_projects
(id, project_id)Remove a Report from a project delete_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_shares_users
(id, user_id)Revoke the permissions a user has on this object get
(id)Show a single report list
(**kwargs)List the reports visible to the current user list_projects
(id)List the projects a Report belongs to list_shares
(id)List users and groups permissioned on this object list_snapshots
(id)Get details about the report’s snapshot automation settings patch
(id, **kwargs)Update a report patch_snapshots
(id, **kwargs)Update the report’s snapshot automation settings post
(**kwargs)Create a report post_grants
(id)Grant this report the ability to perform Civis platform API operations on your post_snapshots
(id, **kwargs)Generate and optionally email a snapshot of the specified report put_archive
(id, status)Update the archive status of this object put_projects
(id, project_id)Add a Report to a project put_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_shares_users
(id, user_ids, permission_level)Set the permissions users have on this object -
delete_grants
(id)¶ Revoke permisstion for this report to perform Civis platform API operations on your behalf
Parameters: id : integer
The ID of this report.
Returns: None
Response code 204: success
-
delete_projects
(id, project_id)¶ Remove a Report from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
get
(id)¶ Show a single report
Parameters: id : integer
The ID of this report.
Returns: auth_data_url : string
valid_output_file : boolean
Whether the job (a script or a query) that backs the report currently has a valid output file.
script : dict:
- name : string The name of the script. - sql : string The raw SQL query for the script. - id : integer The ID for the script.
projects : list:
A list of projects containing the report. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID of this report.
viz_updated_at : string/time
The time that the report’s visualization was last updated.
finished_at : string/time
The time that the report’s last run finished.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
tableau_id : integer
archived : string
The archival status of the requested object(s).
created_at : string/time
api_key_id : integer
The ID of the API key. Can be used for auditing API use by this report.
auth_code_url : string
job_path : string
The link to details of the job that backs this report.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
config : string
Any configuration metadata for this report.
auth_thumbnail_url : string
URL for a thumbnail of the report.
state : string
The status of the report’s last run.
provide_api_key : boolean
Whether the report requests an API Key from the report viewer.
template_id : integer
The ID of the template used for this report.
api_key : string
A Civis API key that can be used by this report.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
app_state : dict
Any application state blob for this report.
updated_at : string/time
name : string
The name of the report.
-
list
(**kwargs)¶ List the reports visible to the current user
Parameters: type : string, optional
If specified, return report of these types. It accepts a comma-separated list, possible values are ‘tableau’, ‘other’.
author : string, optional
If specified, return reports from this author. It accepts a comma-separated list of author ids.
template_id : integer, optional
If specified, return reports using the provided Template.
archived : string, optional
The archival status of the requested object(s).
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
script : dict:
- name : string The name of the script. - sql : string The raw SQL query for the script. - id : integer The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
projects : list:
A list of projects containing the report. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID of this report.
viz_updated_at : string/time
The time that the report’s visualization was last updated.
auth_thumbnail_url : string
URL for a thumbnail of the report.
updated_at : string/time
finished_at : string/time
The time that the report’s last run finished.
template_id : integer
The ID of the template used for this report.
tableau_id : integer
name : string
The name of the report.
archived : string
The archival status of the requested object(s).
state : string
The status of the report’s last run.
job_path : string
The link to details of the job that backs this report.
-
list_projects
(id)¶ List the projects a Report belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_snapshots
(id)¶ Get details about the report’s snapshot automation settings
Parameters: id : integer
The ID of this report.
Returns: height : integer
The height of the cropped snapshot image in screen pixels. The default value is 900 pixels. Minimum value is 600 pixels.
email_subject : string
Subject for Email.
width : integer
The width of the cropped snapshot image in screen pixels. The default value is 1440 pixels. Minimum value is 600 pixels.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer
The ID of the parent job that will trigger this snapshot.
finished_at : string/time
The time that the job’s last run finished.
send_email_on_completion : boolean
Whether the job will send emails on completion.
recipient_email_addresses : string
Email addresses to send report to, comma separated.
email_template : string
Custom email template.
state : string
The status of the job’s last run.
id : integer
The ID of this report.
-
patch
(id, **kwargs)¶ Update a report
Parameters: id : integer
The ID of the report to modify.
template_id : integer, optional
The ID of the template used for this report. If null is passed, no template will back this report. Changes to the backing template will reset the report appState.
script_id : integer, optional
The ID of the job (a script or a query) used to create this report.
provide_api_key : boolean, optional
Allow the report to provide an API key to front-end code.
code_body : string, optional
The code for the report visualization.
name : string, optional
The name of the report.
app_state : dict, optional
The application state blob for this report.
config : string, optional
Returns: auth_data_url : string
valid_output_file : boolean
Whether the job (a script or a query) that backs the report currently has a valid output file.
script : dict:
- name : string The name of the script. - sql : string The raw SQL query for the script. - id : integer The ID for the script.
projects : list:
A list of projects containing the report. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID of this report.
viz_updated_at : string/time
The time that the report’s visualization was last updated.
finished_at : string/time
The time that the report’s last run finished.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
tableau_id : integer
archived : string
The archival status of the requested object(s).
created_at : string/time
api_key_id : integer
The ID of the API key. Can be used for auditing API use by this report.
auth_code_url : string
job_path : string
The link to details of the job that backs this report.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
config : string
Any configuration metadata for this report.
auth_thumbnail_url : string
URL for a thumbnail of the report.
state : string
The status of the report’s last run.
provide_api_key : boolean
Whether the report requests an API Key from the report viewer.
template_id : integer
The ID of the template used for this report.
api_key : string
A Civis API key that can be used by this report.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
app_state : dict
Any application state blob for this report.
updated_at : string/time
name : string
The name of the report.
-
patch_snapshots
(id, **kwargs)¶ Update the report’s snapshot automation settings
Parameters: id : integer
The ID of this report.
height : integer, optional
The height of the cropped snapshot image in screen pixels. The default value is 900 pixels. Minimum value is 600 pixels.
email_subject : string, optional
Subject for Email.
width : integer, optional
The width of the cropped snapshot image in screen pixels. The default value is 1440 pixels. Minimum value is 600 pixels.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this snapshot.
finished_at : string/time, optional
The time that the job’s last run finished.
send_email_on_completion : boolean, optional
Whether the job will send emails on completion.
email_template : string, optional
Custom email template.
state : string, optional
The status of the job’s last run.
recipient_email_addresses : string, optional
Email addresses to send report to, comma separated.
Returns: height : integer
The height of the cropped snapshot image in screen pixels. The default value is 900 pixels. Minimum value is 600 pixels.
email_subject : string
Subject for Email.
width : integer
The width of the cropped snapshot image in screen pixels. The default value is 1440 pixels. Minimum value is 600 pixels.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer
The ID of the parent job that will trigger this snapshot.
finished_at : string/time
The time that the job’s last run finished.
send_email_on_completion : boolean
Whether the job will send emails on completion.
recipient_email_addresses : string
Email addresses to send report to, comma separated.
email_template : string
Custom email template.
state : string
The status of the job’s last run.
id : integer
The ID of this report.
-
post
(**kwargs)¶ Create a report
Parameters: hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
template_id : integer, optional
The ID of the template used for this report.
script_id : integer, optional
The ID of the job (a script or a query) used to create this report.
provide_api_key : boolean, optional
Allow the report to provide an API key to front-end code.
code_body : string, optional
The code for the report visualization.
app_state : dict, optional
Any application state blob for this report.
name : string, optional
The name of the report.
Returns: auth_data_url : string
valid_output_file : boolean
Whether the job (a script or a query) that backs the report currently has a valid output file.
script : dict:
- name : string The name of the script. - sql : string The raw SQL query for the script. - id : integer The ID for the script.
projects : list:
A list of projects containing the report. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID of this report.
viz_updated_at : string/time
The time that the report’s visualization was last updated.
finished_at : string/time
The time that the report’s last run finished.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
tableau_id : integer
archived : string
The archival status of the requested object(s).
created_at : string/time
api_key_id : integer
The ID of the API key. Can be used for auditing API use by this report.
auth_code_url : string
job_path : string
The link to details of the job that backs this report.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
config : string
Any configuration metadata for this report.
auth_thumbnail_url : string
URL for a thumbnail of the report.
state : string
The status of the report’s last run.
provide_api_key : boolean
Whether the report requests an API Key from the report viewer.
template_id : integer
The ID of the template used for this report.
api_key : string
A Civis API key that can be used by this report.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
app_state : dict
Any application state blob for this report.
updated_at : string/time
name : string
The name of the report.
-
post_grants
(id)¶ Grant this report the ability to perform Civis platform API operations on your behalf
Parameters: id : integer
The ID of this report.
Returns: auth_data_url : string
valid_output_file : boolean
Whether the job (a script or a query) that backs the report currently has a valid output file.
script : dict:
- name : string The name of the script. - sql : string The raw SQL query for the script. - id : integer The ID for the script.
projects : list:
A list of projects containing the report. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID of this report.
viz_updated_at : string/time
The time that the report’s visualization was last updated.
finished_at : string/time
The time that the report’s last run finished.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
tableau_id : integer
archived : string
The archival status of the requested object(s).
created_at : string/time
api_key_id : integer
The ID of the API key. Can be used for auditing API use by this report.
auth_code_url : string
job_path : string
The link to details of the job that backs this report.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
config : string
Any configuration metadata for this report.
auth_thumbnail_url : string
URL for a thumbnail of the report.
state : string
The status of the report’s last run.
provide_api_key : boolean
Whether the report requests an API Key from the report viewer.
template_id : integer
The ID of the template used for this report.
api_key : string
A Civis API key that can be used by this report.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
app_state : dict
Any application state blob for this report.
updated_at : string/time
name : string
The name of the report.
-
post_snapshots
(id, **kwargs)¶ Generate and optionally email a snapshot of the specified report
Parameters: id : integer
The ID of this report.
height : integer, optional
The height of the cropped snapshot image in screen pixels. The default value is 900 pixels. Minimum value is 600 pixels.
email_subject : string, optional
Subject for Email.
width : integer, optional
The width of the cropped snapshot image in screen pixels. The default value is 1440 pixels. Minimum value is 600 pixels.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this snapshot.
finished_at : string/time, optional
The time that the job’s last run finished.
send_email_on_completion : boolean, optional
Whether the job will send emails on completion.
email_template : string, optional
Custom email template.
state : string, optional
The status of the job’s last run.
recipient_email_addresses : string, optional
Email addresses to send report to, comma separated.
Returns: height : integer
The height of the cropped snapshot image in screen pixels. The default value is 900 pixels. Minimum value is 600 pixels.
email_subject : string
Subject for Email.
width : integer
The width of the cropped snapshot image in screen pixels. The default value is 1440 pixels. Minimum value is 600 pixels.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer
The ID of the parent job that will trigger this snapshot.
finished_at : string/time
The time that the job’s last run finished.
send_email_on_completion : boolean
Whether the job will send emails on completion.
recipient_email_addresses : string
Email addresses to send report to, comma separated.
email_template : string
Custom email template.
state : string
The status of the job’s last run.
id : integer
The ID of this report.
-
put_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: auth_data_url : string
valid_output_file : boolean
Whether the job (a script or a query) that backs the report currently has a valid output file.
script : dict:
- name : string The name of the script. - sql : string The raw SQL query for the script. - id : integer The ID for the script.
projects : list:
A list of projects containing the report. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID of this report.
viz_updated_at : string/time
The time that the report’s visualization was last updated.
finished_at : string/time
The time that the report’s last run finished.
user : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
tableau_id : integer
archived : string
The archival status of the requested object(s).
created_at : string/time
api_key_id : integer
The ID of the API key. Can be used for auditing API use by this report.
auth_code_url : string
job_path : string
The link to details of the job that backs this report.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
config : string
Any configuration metadata for this report.
auth_thumbnail_url : string
URL for a thumbnail of the report.
state : string
The status of the report’s last run.
provide_api_key : boolean
Whether the report requests an API Key from the report viewer.
template_id : integer
The ID of the template used for this report.
api_key : string
A Civis API key that can be used by this report.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
app_state : dict
Any application state blob for this report.
updated_at : string/time
name : string
The name of the report.
-
put_projects
(id, project_id)¶ Add a Report to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
Scripts¶
-
class
Scripts
(session, return_type='civis')¶ Methods
delete_containers_projects
(id, project_id)Remove a container docker from a project delete_containers_runs
(id, run_id)Cancel a run delete_containers_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_containers_shares_users
(id, user_id)Revoke the permissions a user has on this object delete_custom_projects
(id, project_id)Remove a Job from a project delete_custom_runs
(id, run_id)Cancel a run delete_custom_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_custom_shares_users
(id, user_id)Revoke the permissions a user has on this object delete_javascript_projects
(id, project_id)Remove a scripted sql from a project delete_javascript_runs
(id, run_id)Cancel a run delete_javascript_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_javascript_shares_users
(id, user_id)Revoke the permissions a user has on this object delete_python3_projects
(id, project_id)Remove a python docker from a project delete_python3_runs
(id, run_id)Cancel a run delete_python3_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_python3_shares_users
(id, user_id)Revoke the permissions a user has on this object delete_r_projects
(id, project_id)Remove a r docker from a project delete_r_runs
(id, run_id)Cancel a run delete_r_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_r_shares_users
(id, user_id)Revoke the permissions a user has on this object delete_sql_projects
(id, project_id)Remove a scripts from a project delete_sql_runs
(id, run_id)Cancel a run delete_sql_shares_groups
(id, group_id)Revoke the permissions a group has on this object delete_sql_shares_users
(id, user_id)Revoke the permissions a user has on this object get
(id)Get details about a script get_containers
(id)View a container get_containers_runs
(id, run_id)Check status of a run get_custom
(id)Get a CustomScript get_custom_runs
(id, run_id)Check status of a run get_javascript
(id)Get a JavaScript Script get_javascript_runs
(id, run_id)Check status of a run get_python3
(id)Get a Python Script get_python3_runs
(id, run_id)Check status of a run get_r
(id)Get an R Script get_r_runs
(id, run_id)Check status of a run get_sql
(id)Get a SQL script get_sql_runs
(id, run_id)Check status of a run list
(**kwargs)List scripts list_containers_projects
(id)List the projects a container docker belongs to list_containers_runs
(id, **kwargs)List runs for the given container list_containers_runs_logs
(id, run_id, **kwargs)Get the logs for a run list_containers_runs_outputs
(id, run_id, ...)List the outputs for a run list_containers_shares
(id)List users and groups permissioned on this object list_custom
(**kwargs)List Custom Scripts list_custom_projects
(id)List the projects a Job belongs to list_custom_runs
(id, **kwargs)List runs for the given custom list_custom_runs_logs
(id, run_id, **kwargs)Get the logs for a run list_custom_runs_outputs
(id, run_id, **kwargs)List the outputs for a run list_custom_shares
(id)List users and groups permissioned on this object list_history
(id)Get the run history and outputs of this script list_javascript_projects
(id)List the projects a scripted sql belongs to list_javascript_runs
(id, **kwargs)List runs for the given javascript list_javascript_runs_logs
(id, run_id, **kwargs)Get the logs for a run list_javascript_runs_outputs
(id, run_id, ...)List the outputs for a run list_javascript_shares
(id)List users and groups permissioned on this object list_python3_projects
(id)List the projects a python docker belongs to list_python3_runs
(id, **kwargs)List runs for the given python list_python3_runs_logs
(id, run_id, **kwargs)Get the logs for a run list_python3_runs_outputs
(id, run_id, **kwargs)List the outputs for a run list_python3_shares
(id)List users and groups permissioned on this object list_r_projects
(id)List the projects a r docker belongs to list_r_runs
(id, **kwargs)List runs for the given r list_r_runs_logs
(id, run_id, **kwargs)Get the logs for a run list_r_runs_outputs
(id, run_id, **kwargs)List the outputs for a run list_r_shares
(id)List users and groups permissioned on this object list_sql_projects
(id)List the projects a scripts belongs to list_sql_runs
(id, **kwargs)List runs for the given sql list_sql_runs_logs
(id, run_id, **kwargs)Get the logs for a run list_sql_runs_outputs
(id, run_id, **kwargs)List the outputs for a run list_sql_shares
(id)List users and groups permissioned on this object list_types
()List available script types patch
(id, **kwargs)Update a script patch_containers
(id, **kwargs)Update a container patch_containers_runs
(id, run_id, **kwargs)Update a run patch_custom
(id, **kwargs)Update some attributes of this CustomScript patch_javascript
(id, **kwargs)Update some attributes of this JavaScript Script patch_python3
(id, **kwargs)Update some attributes of this Python Script patch_r
(id, **kwargs)Update some attributes of this R Script patch_sql
(id, **kwargs)Update some attributes of this SQL script post
(credential_id, remote_host_id, sql, ...)Create a script post_cancel
(id)Cancel a run post_containers
(required_resources, ...)Create a container post_containers_runs
(id)Start a run post_containers_runs_heartbeats
(id, run_id)Indicate that the given run is being handled post_containers_runs_logs
(id, run_id, **kwargs)Add log messages post_containers_runs_outputs
(id, run_id, ...)Add an output for a run post_custom
(from_template_id, **kwargs)Create a CustomScript post_custom_runs
(id)Start a run post_custom_runs_outputs
(id, run_id, ...)Add an output for a run post_javascript
(credential_id, ...)Create a JavaScript Script post_javascript_runs
(id)Start a run post_javascript_runs_outputs
(id, run_id, ...)Add an output for a run post_python3
(source, name, **kwargs)Create a Python Script post_python3_runs
(id)Start a run post_python3_runs_outputs
(id, run_id, ...)Add an output for a run post_r
(source, name, **kwargs)Create an R Script post_r_runs
(id)Start a run post_r_runs_outputs
(id, run_id, object_type, ...)Add an output for a run post_run
(id)Run a script post_sql
(credential_id, remote_host_id, sql, ...)Create a SQL script post_sql_runs
(id)Start a run put_containers
(id, required_resources, ...)Edit a container put_containers_archive
(id, status)Update the archive status of this object put_containers_projects
(id, project_id)Add a container docker to a project put_containers_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_containers_shares_users
(id, user_ids, ...)Set the permissions users have on this object put_custom
(id, **kwargs)Replace all attributes of this CustomScript put_custom_archive
(id, status)Update the archive status of this object put_custom_projects
(id, project_id)Add a Job to a project put_custom_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_custom_shares_users
(id, user_ids, ...)Set the permissions users have on this object put_javascript
(id, credential_id, name, ...)Replace all attributes of this JavaScript Script put_javascript_archive
(id, status)Update the archive status of this object put_javascript_projects
(id, project_id)Add a scripted sql to a project put_javascript_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_javascript_shares_users
(id, user_ids, ...)Set the permissions users have on this object put_python3
(id, source, name, **kwargs)Replace all attributes of this Python Script put_python3_archive
(id, status)Update the archive status of this object put_python3_projects
(id, project_id)Add a python docker to a project put_python3_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_python3_shares_users
(id, user_ids, ...)Set the permissions users have on this object put_r
(id, source, name, **kwargs)Replace all attributes of this R Script put_r_archive
(id, status)Update the archive status of this object put_r_projects
(id, project_id)Add a r docker to a project put_r_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_r_shares_users
(id, user_ids, ...)Set the permissions users have on this object put_sql
(id, credential_id, remote_host_id, ...)Replace all attributes of this SQL script put_sql_archive
(id, status)Update the archive status of this object put_sql_projects
(id, project_id)Add a scripts to a project put_sql_shares_groups
(id, group_ids, ...)Set the permissions groups has on this object put_sql_shares_users
(id, user_ids, ...)Set the permissions users have on this object -
delete_containers_projects
(id, project_id)¶ Remove a container docker from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
delete_containers_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the container.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
delete_custom_projects
(id, project_id)¶ Remove a Job from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
delete_custom_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the custom.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
delete_javascript_projects
(id, project_id)¶ Remove a scripted sql from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
delete_javascript_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the javascript.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
delete_python3_projects
(id, project_id)¶ Remove a python docker from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
delete_python3_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the python.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
delete_r_projects
(id, project_id)¶ Remove a r docker from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
delete_r_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the r.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
delete_sql_projects
(id, project_id)¶ Remove a scripts from a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
-
delete_sql_runs
(id, run_id)¶ Cancel a run
Parameters: id : integer
The ID of the sql.
run_id : integer
The ID of the run.
Returns: None
Response code 202: success
Revoke the permissions a group has on this object
Parameters: id : integer
ID of the resource to be revoked
group_id : integer
ID of the group
Returns: None
Response code 204: success
Revoke the permissions a user has on this object
Parameters: id : integer
ID of the resource to be revoked
user_id : integer
ID of the user
Returns: None
Response code 204: success
-
get
(id)¶ Get details about a script
Parameters: id : integer
The ID for the script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of script.
template_script_id : integer
The ID of the template script, if any.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time this script was last updated.
name : string
The name of the script.
-
get_containers
(id)¶ View a container
Parameters: id : integer
The ID for the script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
time_zone : string
The time zone of this script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template script.
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
repo_http_uri : string
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
type : string
The type of the script (e.g Container)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
remote_host_credential_id : integer
The id of the database credentials to pass into the environment of the container.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
docker_image_tag : string
The tag of the docker image to pull from DockerHub (default: latest).
docker_image_name : string
The name of the docker image to pull from DockerHub.
git_credential_id : integer
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
repo_ref : string
The tag or branch of the github repo to clone into the container.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the container.
-
get_containers_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the container.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
container_id : integer
The ID of the container.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
get_custom
(id)¶ Get a CustomScript
Parameters: id : integer
Returns: running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
target_project_id : integer
Target project to which script outputs will be added.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template script.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g Custom)
credential_id : integer
The credential that this script will use.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
get_custom_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the custom.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
custom_id : integer
The ID of the custom.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
get_javascript
(id)¶ Get a JavaScript Script
Parameters: id : integer
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
get_javascript_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the javascript.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
javascript_id : integer
The ID of the javascript.
started_at : string/time
The time the last run started at.
is_cancel_requested : boolean
True if run cancel requested, else false.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
get_python3
(id)¶ Get a Python Script
Parameters: id : integer
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
get_python3_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the python.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
id : integer
The ID of the run.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
python_id : integer
The ID of the python.
-
get_r
(id)¶ Get an R Script
Parameters: id : integer
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
get_r_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the r.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
r_id : integer
The ID of the r.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
get_sql
(id)¶ Get a SQL script
Parameters: id : integer
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
csv_settings : dict:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
get_sql_runs
(id, run_id)¶ Check status of a run
Parameters: id : integer
The ID of the sql.
run_id : integer
The ID of the run.
Returns: finished_at : string/time
The time that this run finished.
error : string
The error message for this run, if present.
sql_id : integer
The ID of this sql.
is_cancel_requested : boolean
True if run cancel requested, else false.
output : list:
A list of the outputs of this script. - path : string The temporary link to download this output file, valid for 36 hours. - file_id : integer The unique ID of the output file. - output_name : string The name of the output file.
started_at : string/time
The time the last run started.
state : string
The state of this run.
id : integer
The ID of this run.
-
list
(**kwargs)¶ List scripts
Parameters: type : string, optional
If specified, return objects of these types. The valid types are ‘sql’, ‘python3’, ‘r’, and ‘javascript’.
author : string, optional
If specified, return objects from this author. Must use user IDs. A comma separated list of IDs is also accepted to return objects from multiple authors.
status : string, optional
If specified, returns objects with one of these statuses. It accepts a comma-separated list, possible values are ‘running’, ‘failed’, ‘succeeded’, ‘idle’, ‘scheduled’.
archived : string, optional
The archival status of the requested object(s).
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at, last_run.updated_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
template_script_id : integer
The ID of the template script, if any.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID for the script.
time_zone : string
The time zone of this script.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
is_template : boolean
Whether others scripts use this one as a template.
updated_at : string/time
The time the script was last updated.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template this script uses, if any.
name : string
The name of the script.
archived : string
The archival status of the requested object(s).
state : string
The status of the script’s last run.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
-
list_containers_projects
(id)¶ List the projects a container docker belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_containers_runs
(id, **kwargs)¶ List runs for the given container
Parameters: id : integer
The ID of the container.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
container_id : integer
The ID of the container.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list_containers_runs_logs
(id, run_id, **kwargs)¶ Get the logs for a run
Parameters: id : integer
The ID of the container.
run_id : integer
The ID of the run.
last_id : integer, optional
The ID of the last log message received. Log entries with this ID value or lower will be omitted.Logs are sorted by ID if this value is provided, and are otherwise sorted by createdAt.
limit : integer, optional
The maximum number of log messages to return. Default of 10000.
Returns: level : string
The level of the log. One of unknown,fatal,error,warn,info,debug.
message : string
The log message.
created_at : string/date-time
The time the log was created.
id : integer
The ID of the log.
-
list_containers_runs_outputs
(id, run_id, **kwargs)¶ List the outputs for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_custom
(**kwargs)¶ List Custom Scripts
Parameters: from_template_id : integer, optional
The template script that this app uses.
author : string, optional
If specified, return objects from this author. Must use user IDs. A comma separated list of IDs is also accepted to return objects from multiple authors.
status : string, optional
If specified, returns objects with one of these statuses. It accepts a comma-separated list, possible values are ‘running’, ‘failed’, ‘succeeded’, ‘idle’, ‘scheduled’.
archived : string, optional
The archival status of the requested object(s).
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
id : integer
The ID for the script.
time_zone : string
The time zone of this script.
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
The time the script was last updated.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template script.
name : string
The name of the script.
archived : string
The archival status of the requested object(s).
state : string
The status of the script’s last run.
type : string
The type of the script (e.g Custom)
-
list_custom_projects
(id)¶ List the projects a Job belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_custom_runs
(id, **kwargs)¶ List runs for the given custom
Parameters: id : integer
The ID of the custom.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
custom_id : integer
The ID of the custom.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list_custom_runs_logs
(id, run_id, **kwargs)¶ Get the logs for a run
Parameters: id : integer
The ID of the custom.
run_id : integer
The ID of the run.
last_id : integer, optional
The ID of the last log message received. Log entries with this ID value or lower will be omitted.Logs are sorted by ID if this value is provided, and are otherwise sorted by createdAt.
limit : integer, optional
The maximum number of log messages to return. Default of 10000.
Returns: level : string
The level of the log. One of unknown,fatal,error,warn,info,debug.
message : string
The log message.
created_at : string/date-time
The time the log was created.
id : integer
The ID of the log.
-
list_custom_runs_outputs
(id, run_id, **kwargs)¶ List the outputs for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_history
(id)¶ Get the run history and outputs of this script
Parameters: id : integer
The ID for the script.
Returns: error : string
The error message for this run, if present.
sql_id : integer
The ID of this sql.
finished_at : string/time
The time that this run finished.
output : list:
A list of the outputs of this script. - path : string The temporary link to download this output file, valid for 36 hours. - file_id : integer The unique ID of the output file. - output_name : string The name of the output file.
is_cancel_requested : boolean
True if run cancel requested, else false.
state : string
The state of this run.
id : integer
The ID of this run.
-
list_javascript_projects
(id)¶ List the projects a scripted sql belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_javascript_runs
(id, **kwargs)¶ List runs for the given javascript
Parameters: id : integer
The ID of the javascript.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
javascript_id : integer
The ID of the javascript.
started_at : string/time
The time the last run started at.
is_cancel_requested : boolean
True if run cancel requested, else false.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list_javascript_runs_logs
(id, run_id, **kwargs)¶ Get the logs for a run
Parameters: id : integer
The ID of the javascript.
run_id : integer
The ID of the run.
last_id : integer, optional
The ID of the last log message received. Log entries with this ID value or lower will be omitted.Logs are sorted by ID if this value is provided, and are otherwise sorted by createdAt.
limit : integer, optional
The maximum number of log messages to return. Default of 10000.
Returns: level : string
The level of the log. One of unknown,fatal,error,warn,info,debug.
message : string
The log message.
created_at : string/date-time
The time the log was created.
id : integer
The ID of the log.
-
list_javascript_runs_outputs
(id, run_id, **kwargs)¶ List the outputs for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_python3_projects
(id)¶ List the projects a python docker belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_python3_runs
(id, **kwargs)¶ List runs for the given python
Parameters: id : integer
The ID of the python.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
id : integer
The ID of the run.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
python_id : integer
The ID of the python.
-
list_python3_runs_logs
(id, run_id, **kwargs)¶ Get the logs for a run
Parameters: id : integer
The ID of the python.
run_id : integer
The ID of the run.
last_id : integer, optional
The ID of the last log message received. Log entries with this ID value or lower will be omitted.Logs are sorted by ID if this value is provided, and are otherwise sorted by createdAt.
limit : integer, optional
The maximum number of log messages to return. Default of 10000.
Returns: level : string
The level of the log. One of unknown,fatal,error,warn,info,debug.
message : string
The log message.
created_at : string/date-time
The time the log was created.
id : integer
The ID of the log.
-
list_python3_runs_outputs
(id, run_id, **kwargs)¶ List the outputs for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_r_projects
(id)¶ List the projects a r docker belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_r_runs
(id, **kwargs)¶ List runs for the given r
Parameters: id : integer
The ID of the r.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
r_id : integer
The ID of the r.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
list_r_runs_logs
(id, run_id, **kwargs)¶ Get the logs for a run
Parameters: id : integer
The ID of the r.
run_id : integer
The ID of the run.
last_id : integer, optional
The ID of the last log message received. Log entries with this ID value or lower will be omitted.Logs are sorted by ID if this value is provided, and are otherwise sorted by createdAt.
limit : integer, optional
The maximum number of log messages to return. Default of 10000.
Returns: level : string
The level of the log. One of unknown,fatal,error,warn,info,debug.
message : string
The log message.
created_at : string/date-time
The time the log was created.
id : integer
The ID of the log.
-
list_r_runs_outputs
(id, run_id, **kwargs)¶ List the outputs for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_sql_projects
(id)¶ List the projects a scripts belongs to
Parameters: id : integer
The ID of the resource.
Returns: author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
created_at : string/time
archived : string
The archival status of the requested object(s).
id : integer
The ID for this project.
description : string
A description of the project
auto_share : boolean
users : list:
Users who can see the project - username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
updated_at : string/time
name : string
The name of this project.
-
list_sql_runs
(id, **kwargs)¶ List runs for the given sql
Parameters: id : integer
The ID of the sql.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: finished_at : string/time
The time that this run finished.
error : string
The error message for this run, if present.
sql_id : integer
The ID of this sql.
is_cancel_requested : boolean
True if run cancel requested, else false.
output : list:
A list of the outputs of this script. - path : string The temporary link to download this output file, valid for 36 hours. - file_id : integer The unique ID of the output file. - output_name : string The name of the output file.
started_at : string/time
The time the last run started.
state : string
The state of this run.
id : integer
The ID of this run.
-
list_sql_runs_logs
(id, run_id, **kwargs)¶ Get the logs for a run
Parameters: id : integer
The ID of the sql.
run_id : integer
The ID of the run.
last_id : integer, optional
The ID of the last log message received. Log entries with this ID value or lower will be omitted.Logs are sorted by ID if this value is provided, and are otherwise sorted by createdAt.
limit : integer, optional
The maximum number of log messages to return. Default of 10000.
Returns: level : string
The level of the log. One of unknown,fatal,error,warn,info,debug.
message : string
The log message.
created_at : string/date-time
The time the log was created.
id : integer
The ID of the log.
-
list_sql_runs_outputs
(id, run_id, **kwargs)¶ List the outputs for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
List users and groups permissioned on this object
Parameters: id : integer
The ID of the object.
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
list_types
()¶ List available script types
Returns: name : string
The name of the type.
-
patch
(id, **kwargs)¶ Update a script
Parameters: id : integer
The ID for the script.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
template_script_id : integer, optional
The ID of the template script, if any. A script cannot both have a template script and be a template for other scripts.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. Cannot be set if this script uses a template script. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
sql : string, optional
The raw SQL query for the script.
name : string, optional
The name of the script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of script.
template_script_id : integer
The ID of the template script, if any.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time this script was last updated.
name : string
The name of the script.
-
patch_containers
(id, **kwargs)¶ Update a container
Parameters: id : integer
The ID for the script.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
repo_ref : string, optional
The tag or branch of the github repo to clone into the container.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
parent_id : integer, optional
The ID of the parent job that will trigger this script
docker_image_name : string, optional
The name of the docker image to pull from DockerHub.
docker_command : string, optional
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
git_credential_id : integer, optional
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
docker_image_tag : string, optional
The tag of the docker image to pull from DockerHub (default: latest).
remote_host_credential_id : integer, optional
The id of the database credentials to pass into the environment of the container.
repo_http_uri : string, optional
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
name : string, optional
The name of the container.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
time_zone : string
The time zone of this script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template script.
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
repo_http_uri : string
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
type : string
The type of the script (e.g Container)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
remote_host_credential_id : integer
The id of the database credentials to pass into the environment of the container.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
docker_image_tag : string
The tag of the docker image to pull from DockerHub (default: latest).
docker_image_name : string
The name of the docker image to pull from DockerHub.
git_credential_id : integer
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
repo_ref : string
The tag or branch of the github repo to clone into the container.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the container.
-
patch_containers_runs
(id, run_id, **kwargs)¶ Update a run
Parameters: id : integer
The ID for the script.
run_id : integer
The ID of the script run.
bocce_started_at : string/date-time, optional
The time when a bocce worker began executing the script.
bocce_accepted_at : string/date-time, optional
The time when a bocce worker began processing the script.
state : string, optional
The state of the script.
Returns: None
Response code 204: success
-
patch_custom
(id, **kwargs)¶ Update some attributes of this CustomScript
Parameters: id : integer
The ID for the script.
credential_id : integer, optional
The credential that this script will use.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
remote_host_id : integer, optional
The remote host ID that this script will connect to.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
name : string, optional
The name of the script.
Returns: running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
target_project_id : integer
Target project to which script outputs will be added.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template script.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g Custom)
credential_id : integer
The credential that this script will use.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
patch_javascript
(id, **kwargs)¶ Update some attributes of this JavaScript Script
Parameters: id : integer
The ID for the script.
credential_id : integer, optional
The credential that this script will use.
name : string, optional
The name of the script.
remote_host_id : integer, optional
The remote host ID that this script will connect to.
next_run_at : string/time, optional
The time of the next scheduled run.
source : string, optional
The body/text of the script.
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
time_zone : string, optional
The time zone of this script.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
patch_python3
(id, **kwargs)¶ Update some attributes of this Python Script
Parameters: id : integer
The ID for the script.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
source : string, optional
The body/text of the script.
target_project_id : integer, optional
Target project to which script outputs will be added.
parent_id : integer, optional
The ID of the parent job that will trigger this script
time_zone : string, optional
The time zone of this script.
name : string, optional
The name of the script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
patch_r
(id, **kwargs)¶ Update some attributes of this R Script
Parameters: id : integer
The ID for the script.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
source : string, optional
The body/text of the script.
target_project_id : integer, optional
Target project to which script outputs will be added.
parent_id : integer, optional
The ID of the parent job that will trigger this script
time_zone : string, optional
The time zone of this script.
name : string, optional
The name of the script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
patch_sql
(id, **kwargs)¶ Update some attributes of this SQL script
Parameters: id : integer
The ID for the script.
credential_id : integer, optional
The credential that this script will use.
remote_host_id : integer, optional
The remote host ID that this script will connect to.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
csv_settings : dict, optional:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
sql : string, optional
The raw SQL query for the script.
name : string, optional
The name of the script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
csv_settings : dict:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post
(credential_id, remote_host_id, sql, name, **kwargs)¶ Create a script
Parameters: credential_id : integer
The credential ID.
remote_host_id : integer
The database ID.
sql : string
The raw SQL query for the script.
name : string
The name of the script.
template_script_id : integer, optional
The ID of the template script, if any. A script cannot both have a template script and be a template for other scripts.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. Cannot be set if this script uses a template script. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
template_script_id : integer
The ID of the template script, if any.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post_cancel
(id)¶ Cancel a run
Parameters: id : integer
The ID of the job.
Returns: is_cancel_requested : boolean
True if run cancel requested, else false.
state : string
The state of the run, one of ‘queued’, ‘running’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_containers
(required_resources, docker_image_name, docker_command, **kwargs)¶ Create a container
Parameters: required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
docker_image_name : string
The name of the docker image to pull from DockerHub.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
repo_ref : string, optional
The tag or branch of the github repo to clone into the container.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
parent_id : integer, optional
The ID of the parent job that will trigger this script
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
git_credential_id : integer, optional
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
docker_image_tag : string, optional
The tag of the docker image to pull from DockerHub (default: latest).
remote_host_credential_id : integer, optional
The id of the database credentials to pass into the environment of the container.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
repo_http_uri : string, optional
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
name : string, optional
The name of the container.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
time_zone : string
The time zone of this script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template script.
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
repo_http_uri : string
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
type : string
The type of the script (e.g Container)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
remote_host_credential_id : integer
The id of the database credentials to pass into the environment of the container.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
docker_image_tag : string
The tag of the docker image to pull from DockerHub (default: latest).
docker_image_name : string
The name of the docker image to pull from DockerHub.
git_credential_id : integer
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
repo_ref : string
The tag or branch of the github repo to clone into the container.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the container.
-
post_containers_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the container.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
container_id : integer
The ID of the container.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_containers_runs_heartbeats
(id, run_id)¶ Indicate that the given run is being handled
Parameters: id : integer
The ID of the container.
run_id : integer
The ID of the run.
Returns: None
Response code 204: success
-
post_containers_runs_logs
(id, run_id, **kwargs)¶ Add log messages
Parameters: id : integer
The ID of the script.
run_id : integer
The ID of the script run.
level : string, optional
The log level of this message [default: info]
messages : list, optional:
- level : string The log level of this message [default: info] - created_at : string/date-time - message : string The log message to store.
message : string, optional
The log message to store.
Returns: None
Response code 204: success
-
post_containers_runs_outputs
(id, run_id, object_type, object_id)¶ Add an output for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
-
post_custom
(from_template_id, **kwargs)¶ Create a CustomScript
Parameters: from_template_id : integer
The ID of the template script.
credential_id : integer, optional
The credential that this script will use.
remote_host_id : integer, optional
The remote host ID that this script will connect to.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
name : string, optional
The name of the script.
Returns: running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
target_project_id : integer
Target project to which script outputs will be added.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template script.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g Custom)
credential_id : integer
The credential that this script will use.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post_custom_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the custom.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
custom_id : integer
The ID of the custom.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_custom_runs_outputs
(id, run_id, object_type, object_id)¶ Add an output for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
-
post_javascript
(credential_id, remote_host_id, source, name, **kwargs)¶ Create a JavaScript Script
Parameters: credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
source : string
The body/text of the script.
name : string
The name of the script.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
target_project_id : integer, optional
Target project to which script outputs will be added.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
time_zone : string, optional
The time zone of this script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post_javascript_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the javascript.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
javascript_id : integer
The ID of the javascript.
started_at : string/time
The time the last run started at.
is_cancel_requested : boolean
True if run cancel requested, else false.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_javascript_runs_outputs
(id, run_id, object_type, object_id)¶ Add an output for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
-
post_python3
(source, name, **kwargs)¶ Create a Python Script
Parameters: source : string
The body/text of the script.
name : string
The name of the script.
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
target_project_id : integer, optional
Target project to which script outputs will be added.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
time_zone : string, optional
The time zone of this script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post_python3_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the python.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
is_cancel_requested : boolean
True if run cancel requested, else false.
id : integer
The ID of the run.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
python_id : integer
The ID of the python.
-
post_python3_runs_outputs
(id, run_id, object_type, object_id)¶ Add an output for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
-
post_r
(source, name, **kwargs)¶ Create an R Script
Parameters: source : string
The body/text of the script.
name : string
The name of the script.
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
target_project_id : integer, optional
Target project to which script outputs will be added.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
time_zone : string, optional
The time zone of this script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post_r_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the r.
Returns: finished_at : string/time
The time the last run completed.
error : string
The error, if any, returned by the run.
r_id : integer
The ID of the r.
is_cancel_requested : boolean
True if run cancel requested, else false.
started_at : string/time
The time the last run started at.
state : string
The state of the run, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the run.
-
post_r_runs_outputs
(id, run_id, object_type, object_id)¶ Add an output for a run
Parameters: id : integer
The ID of the output.
run_id : integer
The ID of the run.
object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
Returns: object_type : string
The type of the output. Valid values are File, Report, Table, or Project
object_id : integer
The ID of the output object.
link : string
The link to retrieve the output object.
name : string
The name of the output object.
-
post_run
(id)¶ Run a script
Parameters: id : integer
The ID for the script.
Returns: None
Response code 204: success
-
post_sql
(credential_id, remote_host_id, sql, name, **kwargs)¶ Create a SQL script
Parameters: credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
sql : string
The raw SQL query for the script.
name : string
The name of the script.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
hidden : boolean, optional
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
target_project_id : integer, optional
Target project to which script outputs will be added.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
csv_settings : dict, optional:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
time_zone : string, optional
The time zone of this script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
csv_settings : dict:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
post_sql_runs
(id)¶ Start a run
Parameters: id : integer
The ID of the sql.
Returns: finished_at : string/time
The time that this run finished.
error : string
The error message for this run, if present.
sql_id : integer
The ID of this sql.
is_cancel_requested : boolean
True if run cancel requested, else false.
output : list:
A list of the outputs of this script. - path : string The temporary link to download this output file, valid for 36 hours. - file_id : integer The unique ID of the output file. - output_name : string The name of the output file.
started_at : string/time
The time the last run started.
state : string
The state of this run.
id : integer
The ID of this run.
-
put_containers
(id, required_resources, docker_image_name, docker_command, **kwargs)¶ Edit a container
Parameters: id : integer
The ID for the script.
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
docker_image_name : string
The name of the docker image to pull from DockerHub.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
repo_ref : string, optional
The tag or branch of the github repo to clone into the container.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
parent_id : integer, optional
The ID of the parent job that will trigger this script
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
git_credential_id : integer, optional
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
docker_image_tag : string, optional
The tag of the docker image to pull from DockerHub (default: latest).
remote_host_credential_id : integer, optional
The id of the database credentials to pass into the environment of the container.
repo_http_uri : string, optional
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
name : string, optional
The name of the container.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
time_zone : string
The time zone of this script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template script.
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
repo_http_uri : string
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
type : string
The type of the script (e.g Container)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
remote_host_credential_id : integer
The id of the database credentials to pass into the environment of the container.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
docker_image_tag : string
The tag of the docker image to pull from DockerHub (default: latest).
docker_image_name : string
The name of the docker image to pull from DockerHub.
git_credential_id : integer
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
repo_ref : string
The tag or branch of the github repo to clone into the container.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the container.
-
put_containers_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
time_zone : string
The time zone of this script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template script.
archived : string
The archival status of the requested object(s).
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
repo_http_uri : string
The location of a github repo to clone into the container, e.g. github.com/my-user/my-repo.git.
type : string
The type of the script (e.g Container)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares.
remote_host_credential_id : integer
The id of the database credentials to pass into the environment of the container.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
docker_command : string
The command to run on the container. Will be run via sh as: [“sh”, “-c”, dockerCommand]
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
docker_image_tag : string
The tag of the docker image to pull from DockerHub (default: latest).
docker_image_name : string
The name of the docker image to pull from DockerHub.
git_credential_id : integer
The id of the git credential to be used when checking out the specified git repo. If not supplied, the first git credential you’ve submitted will be used. Unnecessary if no git repo is specified or the git repo is public.
repo_ref : string
The tag or branch of the github repo to clone into the container.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the container.
-
put_containers_projects
(id, project_id)¶ Add a container docker to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
put_custom
(id, **kwargs)¶ Replace all attributes of this CustomScript
Parameters: id : integer
The ID for the script.
credential_id : integer, optional
The credential that this script will use.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
remote_host_id : integer, optional
The remote host ID that this script will connect to.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
name : string, optional
The name of the script.
Returns: running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
target_project_id : integer
Target project to which script outputs will be added.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template script.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g Custom)
credential_id : integer
The credential that this script will use.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_custom_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
target_project_id : integer
Target project to which script outputs will be added.
finished_at : string/time
The time that the script’s last run finished.
from_template_id : integer
The ID of the template script.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g Custom)
credential_id : integer
The credential that this script will use.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_custom_projects
(id, project_id)¶ Add a Job to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
put_javascript
(id, credential_id, name, remote_host_id, source, **kwargs)¶ Replace all attributes of this JavaScript Script
Parameters: id : integer
The ID for the script.
credential_id : integer
The credential that this script will use.
name : string
The name of the script.
remote_host_id : integer
The remote host ID that this script will connect to.
source : string
The body/text of the script.
next_run_at : string/time, optional
The time of the next scheduled run.
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
time_zone : string, optional
The time zone of this script.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_javascript_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
remote_host_id : integer
The remote host ID that this script will connect to.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_javascript_projects
(id, project_id)¶ Add a scripted sql to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
put_python3
(id, source, name, **kwargs)¶ Replace all attributes of this Python Script
Parameters: id : integer
The ID for the script.
source : string
The body/text of the script.
name : string
The name of the script.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
parent_id : integer, optional
The ID of the parent job that will trigger this script
time_zone : string, optional
The time zone of this script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_python3_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_python3_projects
(id, project_id)¶ Add a python docker to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
put_r
(id, source, name, **kwargs)¶ Replace all attributes of this R Script
Parameters: id : integer
The ID for the script.
source : string
The body/text of the script.
name : string
The name of the script.
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
required_resources : dict, optional:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
parent_id : integer, optional
The ID of the parent job that will trigger this script
time_zone : string, optional
The time zone of this script.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_r_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
source : string
The body/text of the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
required_resources : dict:
- memory : integer The amount of RAM to allocate for the container (in MiB). Must be at least 4 MiB. - disk_space : number/float The amount of disk space, in GB, to allocate for the container. This space will be used to hold the git repo configured for the container and anything your container writes to /tmp or /data. Fractional values (e.g. 0.25) are supported. - cpu : integer The number of CPU shares to allocate for the container. Each core has 1024 shares. Must be at least 2 shares.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_r_projects
(id, project_id)¶ Add a r docker to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
put_sql
(id, credential_id, remote_host_id, sql, name, **kwargs)¶ Replace all attributes of this SQL script
Parameters: id : integer
The ID for the script.
credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
sql : string
The raw SQL query for the script.
name : string
The name of the script.
next_run_at : string/time, optional
The time of the next scheduled run.
schedule : dict, optional:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
parent_id : integer, optional
The ID of the parent job that will trigger this script
params : list, optional:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string, optional
“runner” or “author”, who to execute the script as when run as a template.
notifications : dict, optional:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer, optional
Target project to which script outputs will be added.
time_zone : string, optional
The time zone of this script.
csv_settings : dict, optional:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
arguments : dict, optional
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
csv_settings : dict:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_sql_archive
(id, status)¶ Update the archive status of this object
Parameters: id : integer
The ID of the object.
status : boolean
The desired archived status of the object.
Returns: links : dict:
- runs : string The runs link to get the run information list for this script. - details : string The details link to get more information about the script.
schedule : dict:
- scheduled_runs_per_hour : integer Alternative to scheduled minutes, number of times to run per hour - scheduled_days : list Day based on numeric value starting at 0 for Sunday - scheduled_minutes : list Minutes of the day it is scheduled on - scheduled : boolean If the object is scheduled - scheduled_hours : list Hours of the day it is scheduled on
params : list:
A definition of the parameters this script accepts in the arguments field. - label : string The label to present to users when asking them for the value. - value : string The value you would like to set this param to. Setting this value makes this parameter a fixed param. - type : string The type of parameter. Valid options: string, integer, float, bool, file, database, credential_aws, credential_redshift, or credential_custom - default : string If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool's or false, False, f, n, no, or 0 for false bool's. Cannot be used for parameters that are required or a credential type. - required : boolean Whether this param is required. - description : string A short sentence or fragment describing this parameter to the end user. - name : string The variable's name as used within your code.
user_context : string
“runner” or “author”, who to execute the script as when run as a template.
sql : string
The raw SQL query for the script.
notifications : dict:
- stall_warning_minutes : integer Stall warning emails will be sent after this amount of minutes. - success_email_addresses : list Addresses to notify by e-mail when the job completes successfully. - failure_email_addresses : list Addresses to notify by e-mail when the job fails. - urls : list URLs to receive a POST request at job completion - success_email_subject : string Custom subject line for success e-mail. - success_email_body : string Custom body text for success e-mail, written in Markdown. - success_on : boolean If success email notifications are on - failure_on : boolean If failure email notifications are on
target_project_id : integer
Target project to which script outputs will be added.
id : integer
The ID for the script.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
author : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
template_dependents_count : integer
How many other scripts use this one as a template.
csv_settings : dict:
- column_delimiter : string Which delimiter to use, one of "comma", "tab", or "pipe". Default: comma - unquoted : boolean Whether or not to quote fields. Default: false - filename_prefix : string A user specified filename prefix for the output file to have. Default: null - include_header : boolean Whether or not to include headers in the output data. Default: true - force_multifile : boolean Whether or not the csv should be split into multiple files. Default: false - compression : string The type of compression to use, if any, one of "none", "zip", or "gzip". Default: gzip
finished_at : string/time
The time that the script’s last run finished.
running_as : dict:
- username : string This user's username. - online : boolean Whether this user is online. - name : string This user's name. - initials : string This user's initials. - id : integer The ID of this user.
from_template_id : integer
The ID of the template this script uses, if any.
expanded_arguments : dict
Expanded arguments for use in injecting into different environments.
archived : string
The archival status of the requested object(s).
time_zone : string
The time zone of this script.
type : string
The type of the script (e.g SQL, Container, Python, R, JavaScript)
credential_id : integer
The credential that this script will use.
remote_host_id : integer
The remote host ID that this script will connect to.
hidden : boolean
The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID
next_run_at : string/time
The time of the next scheduled run.
created_at : string/time
The time this script was created.
parent_id : integer
The ID of the parent job that will trigger this script
template_script_name : string
The name of the template script.
projects : list:
A list of projects containing the script. - name : string The name of the project. - id : integer The ID for the project.
code_preview : string
The code that this script will run with arguments inserted.
published_as_template_id : integer
The ID of the template that this script is backing.
is_template : boolean
Whether others scripts use this one as a template.
state : string
The status of the script’s last run.
arguments : dict
Dictionary of name/value pairs to use to run this script. Only settable if this script has defined params.
updated_at : string/time
The time the script was last updated.
name : string
The name of the script.
-
put_sql_projects
(id, project_id)¶ Add a scripts to a project
Parameters: id : integer
ID of the resource
project_id : integer
The ID of the project
Returns: None
Response code 204: success
Set the permissions groups has on this object
Parameters: id : integer
ID of the resource to be shared
group_ids : list
An array of one or more group IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
Set the permissions users have on this object
Parameters: id : integer
ID of the resource to be shared
user_ids : list
An array of one or more user IDs
permission_level : string
Options are: “read”, “write”, or “manage”
Returns: total_group_shares : integer
For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.
total_user_shares : integer
For owners, the number of total users shared. For writers and readers, the number of visible users shared.
owners : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
readers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
writers : dict:
- users : list:: - name : string - id : integer - groups : list:: - name : string - id : integer
-
Tables¶
-
class
Tables
(session, return_type='civis')¶ Methods
get
(id)Show basic table info get_enhancements_cass_ncoa
(id, source_table_id)View the status of a CASS / NCOA table enhancement get_enhancements_geocodings
(id, source_table_id)View the status of a geocoding table enhancement get_enhancements_prepared_matchings
(id, ...)View a prepared matching enhancement get_enhancements_table_matchings
(id, ...)View a table matching enhancement list
(**kwargs)List tables list_columns
(id, **kwargs)List columns in the specified table patch
(id, **kwargs)Update a table post
(schema, name, data, database_id)Import a file into a table post_enhancements_cass_ncoa
(source_table_id, ...)Standardize addresses in a table post_enhancements_geocodings
(source_table_id)Geocode a table post_enhancements_prepared_matchings
(...)Match person records against a dynamo table prepared by Civis post_enhancements_table_matchings
(...)Match person records against an arbitrary Redshift table post_refresh
(id)Request a refresh for column and table statistics -
get
(id)¶ Show basic table info
Parameters: id : integer
Returns: outgoing_table_matches : list:
- target_type : string Target type - job : dict:: - match_options : dict:: - max_matches : integer - threshold : string - updated_at : string/date-time - created_at : string/date-time - runs : list:: Information about the most recent runs of the job. - error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer - last_run : dict:: - error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer - id : integer - hidden : boolean The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID - type : string - state : string Whether the job is idle, queued, running, cancelled, or failed. - name : string - target_id : integer Target ID - source_table_id : integer Source table - target : dict:: - name : string
database_id : integer
The ID of the database.
view_def : string
sortkeys : string
The column used as the Amazon Redshift sortkey.
id : integer
The ID of the table.
schema : string
The name of the schema containing the table.
enhancements : list:
- join_id : integer - type : string - updated_at : string/time - created_at : string/time
refresh_status : string
How up-to-date the table’s statistics on row counts, null counts, distinct counts, and values distributions are. One of: refreshing, stale, or current.
row_count : integer
The number of rows in the table.
description : string
The description of the table, as specified by the table owner
owner : string
The database username of the table’s owner.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
refresh_id : string
The ID of the most recent statistics refresh.
ontology_mapping : dict
The ontology-key to column-name mapping. See /ontology for the list of valid ontology keys.
multipart_key : list
is_view : boolean
True if this table represents a view. False if it represents a regular table.
size_mb : number/float
The size of the table in megabytes.
distkey : string
The column used as the Amazon Redshift distkey.
joins : list:
- left_join : boolean - right_identifier : string - right_table_id : integer - left_identifier : string - created_at : string/time - left_table_id : integer - on : string - updated_at : string/time - id : integer
column_count : integer
The number of columns in the table.
last_refresh : string/date-time
The time of the last statistics refresh.
columns : list:
- stddev : number/float Stddev of the column, where applicable. - value_distribution : dict An object mapping distinct values in the column to the number of times they appear in the column - coverage_count : integer Number of non-null values in the column. - order : integer Relative position of the column in the table. - distinct_count : integer Number of distinct values in the column. - avg_value : number/float Average value of the column, where applicable. - useable_as_primary_key : boolean Whether the column may be used as an primary key to identify table rows. - min_value : string Smallest value in the column. - possible_dependent_variable_types : list Possible dependent variable types the column may be used to model. Null if it may not be used as a dependent variable. - encoding : string The compression encoding for this columnSee: http://docs.aws.amazon.com /redshift/latest/dg/c_Compression_encodings.html - value_distribution_percent : dict A mapping between each value in the column and the percentage of rows with that value.Only present for tables with fewer than approximately 25,000,000 rows and for columns with fewer than twenty distinct values. - sql_type : string SQL type of the column. - null_count : integer Number of null values in the column. - max_value : string Largest value in the column. - description : string The description of the column, as specified by the table owner - sample_values : list A sample of values from the column. - useable_as_independent_variable : boolean Whether the column may be used as an independent variable to train a model. - name : string Name of the column.
name : string
Name of the table.
-
get_enhancements_cass_ncoa
(id, source_table_id)¶ View the status of a CASS / NCOA table enhancement
Parameters: id : integer
The ID of the enhancement.
source_table_id : integer
The ID of the table that was enhanced.
Returns: perform_ncoa : boolean
Whether to update addresses for records matching the National Change of Address (NCOA) database.
ncoa_credential_id : integer
Credential to use when performing NCOA updates. Required if ‘performNcoa’ is true.
output_level : string
The set of fields persisted by a CASS or NCOA enhancement.For CASS enhancements, one of ‘cass’ or ‘all.’For NCOA enhancements, one of ‘cass’, ‘ncoa’ , ‘coalesced’ or ‘all’.By default, all fields will be returned.
enhanced_table_name : string
The name of the table created by the enhancement.
id : integer
The ID of the enhancement.
enhanced_table_schema : string
The schema name of the table created by the enhancement.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
source_table_id : integer
The ID of the table that was enhanced.
-
get_enhancements_geocodings
(id, source_table_id)¶ View the status of a geocoding table enhancement
Parameters: id : integer
The ID of the enhancement.
source_table_id : integer
The ID of the table that was enhanced.
Returns: enhanced_table_schema : string
The schema name of the table created by the enhancement.
enhanced_table_name : string
The name of the table created by the enhancement.
source_table_id : integer
The ID of the table that was enhanced.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the enhancement.
-
get_enhancements_prepared_matchings
(id, source_table_id)¶ View a prepared matching enhancement
Parameters: id : integer
The ID of the enhancement.
source_table_id : integer
The ID of the table that was enhanced.
Returns: max_matches : integer
The maximum number of individuals a person may be matched with.A value of 0 indicates that all matches should be returned.
match_table_id : integer
The ID of the Dynamo table to match against.
threshold : number/float
The confidence threshold which must be met for two individuals to be declared a match. Must be less than or equal to 1 and greater than or equal to 0.
enhanced_table_name : string
The name of the table created by the enhancement.
id : integer
The ID of the enhancement.
enhanced_table_schema : string
The schema name of the table created by the enhancement.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
source_table_id : integer
The ID of the table that was enhanced.
-
get_enhancements_table_matchings
(id, source_table_id)¶ View a table matching enhancement
Parameters: id : integer
The ID of the enhancement.
source_table_id : integer
The ID of the table that was enhanced.
Returns: max_matches : integer
The maximum number of individuals a person may be matched with.A value of 0 indicates that all matches should be returned.
match_table_id : integer
The ID of the Redshift table to match against.
threshold : number/float
The confidence threshold which must be met for two individuals to be declared a match. Must be less than or equal to 1 and greater than or equal to 0.
enhanced_table_name : string
The name of the table created by the enhancement.
id : integer
The ID of the enhancement.
enhanced_table_schema : string
The schema name of the table created by the enhancement.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
source_table_id : integer
The ID of the table that was enhanced.
-
list
(**kwargs)¶ List tables
Parameters: database_id : integer, optional
The ID of the database.
schema : string, optional
If specified, will be used to filter the tables returned. Substring matching is supported with “%” and “*” wildcards (e.g., “schema=%census%” will return both “client_census.table” and “census_2010.table”).
name : string, optional
If specified, will be used to filter the tables returned. Substring matching is supported with “%” and “*” wildcards (e.g., “name=%table%” will return both “table1” and “my table”).
search : string, optional
If specified, will be used to filter the tables returned. Will search across schema and name (in the full form schema.name) and will return any full name containing the search string.
limit : integer, optional
Number of results to return. Defaults to 50. Maximum allowed is 1000.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to schema. Must be one of: schema, name, search.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: refresh_id : string
The ID of the most recent statistics refresh.
database_id : integer
The ID of the database.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
sortkeys : string
The column used as the Amazon Redshift sortkey.
is_view : boolean
True if this table represents a view. False if it represents a regular table.
id : integer
The ID of the table.
size_mb : number/float
The size of the table in megabytes.
schema : string
The name of the schema containing the table.
distkey : string
The column used as the Amazon Redshift distkey.
column_count : integer
The number of columns in the table.
refresh_status : string
How up-to-date the table’s statistics on row counts, null counts, distinct counts, and values distributions are. One of: refreshing, stale, or current.
row_count : integer
The number of rows in the table.
last_refresh : string/date-time
The time of the last statistics refresh.
description : string
The description of the table, as specified by the table owner
owner : string
The database username of the table’s owner.
name : string
Name of the table.
-
list_columns
(id, **kwargs)¶ List columns in the specified table
Parameters: id : integer
name : string, optional
Search for columns with the given name, within the specified table.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to name. Must be one of: name, order.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: stddev : number/float
Stddev of the column, where applicable.
value_distribution : dict
An object mapping distinct values in the column to the number of times they appear in the column
coverage_count : integer
Number of non-null values in the column.
order : integer
Relative position of the column in the table.
distinct_count : integer
Number of distinct values in the column.
avg_value : number/float
Average value of the column, where applicable.
useable_as_primary_key : boolean
Whether the column may be used as an primary key to identify table rows.
min_value : string
Smallest value in the column.
possible_dependent_variable_types : list
Possible dependent variable types the column may be used to model. Null if it may not be used as a dependent variable.
encoding : string
The compression encoding for this columnSee: http://docs.aws.amazon.com/redshift/latest/dg/c_Compression_encodings.html
value_distribution_percent : dict
A mapping between each value in the column and the percentage of rows with that value.Only present for tables with fewer than approximately 25,000,000 rows and for columns with fewer than twenty distinct values.
sql_type : string
SQL type of the column.
null_count : integer
Number of null values in the column.
max_value : string
Largest value in the column.
description : string
The description of the column, as specified by the table owner
sample_values : list
A sample of values from the column.
useable_as_independent_variable : boolean
Whether the column may be used as an independent variable to train a model.
name : string
Name of the column.
-
patch
(id, **kwargs)¶ Update a table
Parameters: id : integer
The ID of the table.
ontology_mapping : dict, optional
The ontology-key to column-name mapping. See /ontology for the list of valid ontology keys.
description : string, optional
The user-defined description of the table.
Returns: refresh_id : string
The ID of the most recent statistics refresh.
ontology_mapping : dict
The ontology-key to column-name mapping. See /ontology for the list of valid ontology keys.
database_id : integer
The ID of the database.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
sortkeys : string
The column used as the Amazon Redshift sortkey.
is_view : boolean
True if this table represents a view. False if it represents a regular table.
id : integer
The ID of the table.
size_mb : number/float
The size of the table in megabytes.
schema : string
The name of the schema containing the table.
distkey : string
The column used as the Amazon Redshift distkey.
column_count : integer
The number of columns in the table.
refresh_status : string
How up-to-date the table’s statistics on row counts, null counts, distinct counts, and values distributions are. One of: refreshing, stale, or current.
row_count : integer
The number of rows in the table.
last_refresh : string/date-time
The time of the last statistics refresh.
description : string
The description of the table, as specified by the table owner
owner : string
The database username of the table’s owner.
name : string
Name of the table.
-
post
(schema, name, data, database_id)¶ Import a file into a table
Parameters: schema : string
The destination schema name.
name : string
The destination table name, without the schema prefix.
data : string
The file to import, uploaded using HTTP multipart.
database_id : integer
The ID of the destination database.
Returns: finished_at : string/date-time
The end time of the last run.
schema : string
The destination schema name.
database_id : integer
The ID of the destination database.
started_at : string/date-time
The start time of the last run.
state : string
The state of the last run.
name : string
The destination table name, without the schema prefix.
-
post_enhancements_cass_ncoa
(source_table_id, **kwargs)¶ Standardize addresses in a table
Parameters: source_table_id : integer
The ID of the table to be enhanced.
perform_ncoa : boolean, optional
Whether to update addresses for records matching the National Change of Address (NCOA) database.
output_level : string, optional
The set of fields persisted by a CASS or NCOA enhancement.For CASS enhancements, one of ‘cass’ or ‘all.’For NCOA enhancements, one of ‘cass’, ‘ncoa’ , ‘coalesced’ or ‘all’.By default, all fields will be returned.
ncoa_credential_id : integer, optional
Credential to use when performing NCOA updates. Required if ‘performNcoa’ is true.
Returns: perform_ncoa : boolean
Whether to update addresses for records matching the National Change of Address (NCOA) database.
ncoa_credential_id : integer
Credential to use when performing NCOA updates. Required if ‘performNcoa’ is true.
output_level : string
The set of fields persisted by a CASS or NCOA enhancement.For CASS enhancements, one of ‘cass’ or ‘all.’For NCOA enhancements, one of ‘cass’, ‘ncoa’ , ‘coalesced’ or ‘all’.By default, all fields will be returned.
enhanced_table_name : string
The name of the table created by the enhancement.
id : integer
The ID of the enhancement.
enhanced_table_schema : string
The schema name of the table created by the enhancement.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
source_table_id : integer
The ID of the table that was enhanced.
-
post_enhancements_geocodings
(source_table_id)¶ Geocode a table
Parameters: source_table_id : integer
The ID of the table to be enhanced.
Returns: enhanced_table_schema : string
The schema name of the table created by the enhancement.
enhanced_table_name : string
The name of the table created by the enhancement.
source_table_id : integer
The ID of the table that was enhanced.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
id : integer
The ID of the enhancement.
-
post_enhancements_prepared_matchings
(source_table_id, match_table_id, threshold, **kwargs)¶ Match person records against a dynamo table prepared by Civis
Parameters: source_table_id : integer
The ID of the table to be enhanced.
match_table_id : integer
The ID of the Dynamo table to match against.
threshold : number/float
The confidence threshold which must be met for two individuals to be declared a match. Must be less than or equal to 1 and greater than or equal to 0.
max_matches : integer, optional
The maximum number of individuals a person may be matched with.A value of 0 indicates that all matches should be returned.
Returns: max_matches : integer
The maximum number of individuals a person may be matched with.A value of 0 indicates that all matches should be returned.
match_table_id : integer
The ID of the Dynamo table to match against.
threshold : number/float
The confidence threshold which must be met for two individuals to be declared a match. Must be less than or equal to 1 and greater than or equal to 0.
enhanced_table_name : string
The name of the table created by the enhancement.
id : integer
The ID of the enhancement.
enhanced_table_schema : string
The schema name of the table created by the enhancement.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
source_table_id : integer
The ID of the table that was enhanced.
-
post_enhancements_table_matchings
(source_table_id, match_table_id, threshold, **kwargs)¶ Match person records against an arbitrary Redshift table
Parameters: source_table_id : integer
The ID of the table to be enhanced.
match_table_id : integer
The ID of the Redshift table to match against.
threshold : number/float
The confidence threshold which must be met for two individuals to be declared a match. Must be less than or equal to 1 and greater than or equal to 0.
max_matches : integer, optional
The maximum number of individuals a person may be matched with.A value of 0 indicates that all matches should be returned.
Returns: max_matches : integer
The maximum number of individuals a person may be matched with.A value of 0 indicates that all matches should be returned.
match_table_id : integer
The ID of the Redshift table to match against.
threshold : number/float
The confidence threshold which must be met for two individuals to be declared a match. Must be less than or equal to 1 and greater than or equal to 0.
enhanced_table_name : string
The name of the table created by the enhancement.
id : integer
The ID of the enhancement.
enhanced_table_schema : string
The schema name of the table created by the enhancement.
state : string
The state of the enhancement, one of ‘queued’ ‘running’ ‘succeeded’ ‘failed’ or ‘cancelled’.
source_table_id : integer
The ID of the table that was enhanced.
-
post_refresh
(id)¶ Request a refresh for column and table statistics
Parameters: id : integer
Returns: outgoing_table_matches : list:
- target_type : string Target type - job : dict:: - match_options : dict:: - max_matches : integer - threshold : string - updated_at : string/date-time - created_at : string/date-time - runs : list:: Information about the most recent runs of the job. - error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer - last_run : dict:: - error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer - id : integer - hidden : boolean The hidden status of the object. Setting this to true hides it from most API endpoints. The object can still be queried directly by ID - type : string - state : string Whether the job is idle, queued, running, cancelled, or failed. - name : string - target_id : integer Target ID - source_table_id : integer Source table - target : dict:: - name : string
database_id : integer
The ID of the database.
view_def : string
sortkeys : string
The column used as the Amazon Redshift sortkey.
id : integer
The ID of the table.
schema : string
The name of the schema containing the table.
enhancements : list:
- join_id : integer - type : string - updated_at : string/time - created_at : string/time
refresh_status : string
How up-to-date the table’s statistics on row counts, null counts, distinct counts, and values distributions are. One of: refreshing, stale, or current.
row_count : integer
The number of rows in the table.
description : string
The description of the table, as specified by the table owner
owner : string
The database username of the table’s owner.
last_run : dict:
- error : string The error message for this run, if present. - created_at : string/time The time that the run was queued. - finished_at : string/time The time that the run completed. - started_at : string/time The time that the run started. - state : string - id : integer
refresh_id : string
The ID of the most recent statistics refresh.
ontology_mapping : dict
The ontology-key to column-name mapping. See /ontology for the list of valid ontology keys.
multipart_key : list
is_view : boolean
True if this table represents a view. False if it represents a regular table.
size_mb : number/float
The size of the table in megabytes.
distkey : string
The column used as the Amazon Redshift distkey.
joins : list:
- left_join : boolean - right_identifier : string - right_table_id : integer - left_identifier : string - created_at : string/time - left_table_id : integer - on : string - updated_at : string/time - id : integer
column_count : integer
The number of columns in the table.
last_refresh : string/date-time
The time of the last statistics refresh.
columns : list:
- stddev : number/float Stddev of the column, where applicable. - value_distribution : dict An object mapping distinct values in the column to the number of times they appear in the column - coverage_count : integer Number of non-null values in the column. - order : integer Relative position of the column in the table. - distinct_count : integer Number of distinct values in the column. - avg_value : number/float Average value of the column, where applicable. - useable_as_primary_key : boolean Whether the column may be used as an primary key to identify table rows. - min_value : string Smallest value in the column. - possible_dependent_variable_types : list Possible dependent variable types the column may be used to model. Null if it may not be used as a dependent variable. - encoding : string The compression encoding for this columnSee: http://docs.aws.amazon.com /redshift/latest/dg/c_Compression_encodings.html - value_distribution_percent : dict A mapping between each value in the column and the percentage of rows with that value.Only present for tables with fewer than approximately 25,000,000 rows and for columns with fewer than twenty distinct values. - sql_type : string SQL type of the column. - null_count : integer Number of null values in the column. - max_value : string Largest value in the column. - description : string The description of the column, as specified by the table owner - sample_values : list A sample of values from the column. - useable_as_independent_variable : boolean Whether the column may be used as an independent variable to train a model. - name : string Name of the column.
name : string
Name of the table.
-
Users¶
-
class
Users
(session, return_type='civis')¶ Methods
delete_api_keys
(id, key_id)Revoke the specified API key get
(id)Show info about a user get_api_keys
(id, key_id)Show the specified API key list
(**kwargs)List users list_api_keys
(id, **kwargs)Show API keys belonging to the specified user list_me
()Show info about the logged-in user patch_me
(**kwargs)Update info about the logged-in user post_api_keys
(id, expires_in, name, **kwargs)Create a new API key belonging to the logged-in user -
delete_api_keys
(id, key_id)¶ Revoke the specified API key
Parameters: id : string
The ID of the user or ‘me’.
key_id : integer
The ID of the API key.
Returns: constraints : list:
Constraints on the abilities of the created key - get_allowed : boolean Whether the constraint allows GET requests. - patch_allowed : boolean Whether the constraint allows PATCH requests. - head_allowed : boolean Whether the constraint allows HEAD requests. - put_allowed : boolean Whether the constraint allows PUT requests. - constraint_type : string The type of constraint (exact/prefix/regex/verb). - constraint : string The path matcher of the constraint. - post_allowed : boolean Whether the constraint allows POST requests. - delete_allowed : boolean Whether the constraint allows DELETE requests.
active : boolean
True if the key has neither expired nor been revoked.
expires_at : string/date-time
The date and time when the key expired.
created_at : string/date-time
The date and time when the key was created.
expired : boolean
True if the key has expired.
scopes : list
The scopes which the key is permissioned on.
id : integer
The ID of the API key.
name : string
The name of the API key.
last_used_at : string/date-time
The date and time when the key was last used.
use_count : integer
The number of times the key has been used.
revoked_at : string/date-time
The date and time when the key was revoked.
-
get
(id)¶ Show info about a user
Parameters: id : integer
The ID of this user.
Returns: title : string
The title of this user.
active : string
The account status of this user.
otp_required_for_login : string
The two factor authorization requirement for this user.
user : string
The username of this user.
github_username : string
The GitHub username of this user.
phone : string
The phone number of this user.
city : string
The city of this user.
id : integer
The ID of this user.
primary_group_id : integer
The ID of the primary group of this user.
department : string
The deartment of this user.
initials : string
The initials of this user.
time_zone : string
The time zone of this user.
email : string
The email of this user.
vpn_enabled : string
The availability of vpn for this user.
prefers_sms_otp : string
The preference for phone authorization of this user
groups : list:
An array of all the groups this user is in. - organization_id : integer The organization associated with this group. - name : string The name of this group. - id : integer The ID of this group.
state : string
The state of this user.
name : string
The name of this user.
-
get_api_keys
(id, key_id)¶ Show the specified API key
Parameters: id : string
The ID of the user or ‘me’.
key_id : integer
The ID of the API key.
Returns: constraints : list:
Constraints on the abilities of the created key - get_allowed : boolean Whether the constraint allows GET requests. - patch_allowed : boolean Whether the constraint allows PATCH requests. - head_allowed : boolean Whether the constraint allows HEAD requests. - put_allowed : boolean Whether the constraint allows PUT requests. - constraint_type : string The type of constraint (exact/prefix/regex/verb). - constraint : string The path matcher of the constraint. - post_allowed : boolean Whether the constraint allows POST requests. - delete_allowed : boolean Whether the constraint allows DELETE requests.
active : boolean
True if the key has neither expired nor been revoked.
expires_at : string/date-time
The date and time when the key expired.
created_at : string/date-time
The date and time when the key was created.
expired : boolean
True if the key has expired.
scopes : list
The scopes which the key is permissioned on.
id : integer
The ID of the API key.
name : string
The name of the API key.
last_used_at : string/date-time
The date and time when the key was last used.
use_count : integer
The number of times the key has been used.
revoked_at : string/date-time
The date and time when the key was revoked.
-
list
(**kwargs)¶ List users
Parameters: feature_flag : string, optional
Return users that have a feature flag enabled.
account_status : string, optional
The account status by which to filter users. May be one of “active”, “inactive”, or “all”.
query : string, optional
Return users who match the given query, based on name, user, and email.
group_id : integer, optional
The ID of the group by which to filter users. Cannot be present if organization_id is.
organization_id : integer, optional
The ID of the organization by which to filter users. Cannot be present if group_id is.
limit : integer, optional
Number of results to return. Defaults to 20. Maximum allowed is 10000.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to name. Must be one of: name, user.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: primary_group_id : integer
The ID of the primary group of this user.
active : string
The account status of this user.
user : string
The username of this user.
created_at : string/date-time
The date and time when the user was created.
current_sign_in_at : string/date-time
The date and time when the user’s current session began.
id : integer
The ID of this user.
groups : list:
An array of all the groups this user is in. - organization_id : integer The organization associated with this group. - name : string The name of this group. - id : integer The ID of this group.
email : string
The email of this user.
name : string
The name of this user.
-
list_api_keys
(id, **kwargs)¶ Show API keys belonging to the specified user
Parameters: id : string
The ID of the user or ‘me’.
limit : integer, optional
Number of results to return. Defaults to its maximum of 50.
page_num : integer, optional
Page number of the results to return. Defaults to the first page, 1.
order : string, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
order_dir : string, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
iterator : bool, optional
If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.
Returns: active : boolean
True if the key has neither expired nor been revoked.
expires_at : string/date-time
The date and time when the key expired.
created_at : string/date-time
The date and time when the key was created.
expired : boolean
True if the key has expired.
scopes : list
The scopes which the key is permissioned on.
constraint_count : integer
The number of constraints on the created key
id : integer
The ID of the API key.
name : string
The name of the API key.
last_used_at : string/date-time
The date and time when the key was last used.
use_count : integer
The number of times the key has been used.
revoked_at : string/date-time
The date and time when the key was revoked.
-
list_me
()¶ Show info about the logged-in user
Returns: last_checked_announcements : string/date-time
The date and time at which the user last checked their announcements.
preferences : dict
This user’s preferences.
feature_flags : dict
The feature flag settings for this user.
id : integer
The ID of this user.
username : string
This user’s username.
custom_branding : string
The branding of Platform for this user.
organization_name : string
The name of the organization the user belongs to.
initials : string
This user’s initials.
roles : list
The roles this user has, listed by slug.
groups : list:
An array of all the groups this user is in. - organization_id : integer The organization associated with this group. - name : string The name of this group. - id : integer The ID of this group.
email : string
This user’s email address.
name : string
This user’s name.
-
patch_me
(**kwargs)¶ Update info about the logged-in user
Parameters: last_checked_announcements : string/date-time, optional
The date and time at which the user last checked their announcements.
preferences : dict, optional:
- enhancement_index_author_filter : string Author filter for the enhancements index page. - civis_explore_skip_intro : boolean Whether the user is shown steps for each exploration. - export_index_status_filter : string Status filter for the exports index page. - script_index_type_filter : string Type filter for the scripts index page. - enhancement_index_archived_filter : string Archived filter for the enhancements index page. - result_index_archived_filter : string Archived filter for the results index page. - result_index_order_field : string Order field for the results index page. - export_index_order_dir : string Order direction for the exports index page. - import_index_status_filter : string Status filter for the imports index page. - import_index_order_dir : string Order direction for the imports index page. - result_index_author_filter : string Author filter for the results index page. - script_index_author_filter : string Author filter for the scripts index page. - script_index_archived_filter : string Archived filter for the scripts index page. - import_index_archived_filter : string Archived filter for the imports index page. - export_index_order_field : string Order field for the exports index page. - export_index_type_filter : string Type filter for the exports index page. - model_index_order_field : string Order field for the models index page. - app_index_order_field : string Order field for the apps index pages. - import_index_author_filter : string Author filter for the imports index page. - project_detail_type_filter : string Type filter for projects detail pages. - model_index_order_dir : string Order direction for the models index page. - model_index_status_filter : string Status filter for the models index page. - preferred_server_id : integer ID of preferred server. - result_index_order_dir : string Order direction for the results index page. - import_index_dest_filter : string Destination filter for the imports index page. - model_index_author_filter : string Author filter for the models index page. - import_index_order_field : string Order field for the imports index page. - project_index_order_dir : string Order direction for the projects index page. - report_index_thumbnail_view : string Thumbnail view for the reports index page. - export_index_author_filter : string Author filter for the exports index page. - script_index_status_filter : string Status filter for the scripts index page. - enhancement_index_order_dir : string Order direction for the enhancements index page. - model_index_thumbnail_view : string Thumbnail view for the models index page. - enhancement_index_order_field : string Order field for the enhancements index page. - script_index_order_dir : string Order direction for the scripts index page. - result_index_type_filter : string Type filter for the results index page. - app_index_order_dir : string Oder direction for the apps index pages. - script_index_order_field : string Order field for the scripts index page. - model_index_archived_filter : string Archived filter for the models index page. - project_detail_order_field : string Order field for projects detail pages. - project_detail_archived_filter : string Arhived filter for the projects detail pages. - project_index_order_field : string Order field for the projects index page. - import_index_type_filter : string Type filter for the imports index page. - project_detail_order_dir : string Order direction for projects detail pages. - project_detail_author_filter : string Author filter for projects detail pages. - project_index_archived_filter : string Archived filter for the projects index page. - project_index_author_filter : string Author filter for the projects index page.
Returns: last_checked_announcements : string/date-time
The date and time at which the user last checked their announcements.
preferences : dict
This user’s preferences.
feature_flags : dict
The feature flag settings for this user.
id : integer
The ID of this user.
username : string
This user’s username.
custom_branding : string
The branding of Platform for this user.
organization_name : string
The name of the organization the user belongs to.
initials : string
This user’s initials.
roles : list
The roles this user has, listed by slug.
groups : list:
An array of all the groups this user is in. - organization_id : integer The organization associated with this group. - name : string The name of this group. - id : integer The ID of this group.
email : string
This user’s email address.
name : string
This user’s name.
-
post_api_keys
(id, expires_in, name, **kwargs)¶ Create a new API key belonging to the logged-in user
Parameters: id : string
The ID of the user or ‘me’.
expires_in : integer
The number of seconds the key should last for.
name : string
The name of the API key.
constraints : list, optional:
Constraints on the abilities of the created key. - get_allowed : boolean Whether the constraint allows GET requests. - patch_allowed : boolean Whether the constraint allows PATCH requests. - head_allowed : boolean Whether the constraint allows HEAD requests. - put_allowed : boolean Whether the constraint allows PUT requests. - constraint_type : string The type of constraint (exact/prefix/regex/verb). - constraint : string The path matcher of the constraint. - post_allowed : boolean Whether the constraint allows POST requests. - delete_allowed : boolean Whether the constraint allows DELETE requests.
Returns: active : boolean
True if the key has neither expired nor been revoked.
use_count : integer
The number of times the key has been used.
expires_at : string/date-time
The date and time when the key expired.
created_at : string/date-time
The date and time when the key was created.
scopes : list
The scopes which the key is permissioned on.
expired : boolean
True if the key has expired.
token : string
The API key.
id : integer
The ID of the API key.
constraints : list:
Constraints on the abilities of the created key - get_allowed : boolean Whether the constraint allows GET requests. - patch_allowed : boolean Whether the constraint allows PATCH requests. - head_allowed : boolean Whether the constraint allows HEAD requests. - put_allowed : boolean Whether the constraint allows PUT requests. - constraint_type : string The type of constraint (exact/prefix/regex/verb). - constraint : string The path matcher of the constraint. - post_allowed : boolean Whether the constraint allows POST requests. - delete_allowed : boolean Whether the constraint allows DELETE requests.
revoked_at : string/date-time
The date and time when the key was revoked.
last_used_at : string/date-time
The date and time when the key was last used.
name : string
The name of the API key.
-
Command Line Interface¶
A command line interface (CLI) to Civis is provided. This can be invoked by
typing the command civis
in the shell (sh, bash, zsh, etc.). It can also
be used in Civis container scripts where the Docker image has this client
installed. Here’s a simple example of printing the types of scripts.
> civis scripts list-types
- name: sql
- name: python3
- name: javascript
- name: r
- name: containers
Not all API endpoints are available through the CLI since some take complex data types (e.g., arrays, objects/dictionaries) as input. However, functionality is available for getting information about scripts, logs, etc., as well as executing already created scripts.
There are a few extra, CLI-only commands that wrap the Files API
endpoints to make uploading and downloading files easier:
civis files upload $PATH
and civis files download $FILEID $PATH
.
The default output format is YAML, but the --json-output
allows you to
get output in JSON.