Exports
- class Exports(session_kwargs, client, return_type='raw')
Methods
delete_files_csv_runs
(id, run_id)Cancel a run
get_files_csv
(id)Get a CSV Export
get_files_csv_runs
(id, run_id)Check status of a run
list
(*[, type, status, author, hidden, ...])List
list_files_csv_runs
(id, *[, limit, ...])List runs for the given CSV Export job
list_files_csv_runs_logs
(id, run_id, *[, ...])Get the logs for a run
list_files_csv_runs_outputs
(id, run_id, *[, ...])List the outputs for a run
patch_files_csv
(id, *[, name, source, ...])Update some attributes of this CSV Export
post_files_csv
(source, destination, *[, ...])Create a CSV Export
Start a run
put_files_csv
(id, source, destination, *[, ...])Replace all attributes of this CSV Export
put_files_csv_archive
(id, status)Update the archive status of this object
Examples
>>> import civis >>> client = civis.APIClient() >>> client.exports.list(...)
- delete_files_csv_runs(id: int, run_id: int) Response
Cancel a run
- Parameters:
- idint
The ID of the CSV Export job.
- run_idint
The ID of the run.
- Returns:
- None
Response code 202: success
- get_files_csv(id: int) Response
Get a CSV Export
- Parameters:
- idint
- Returns:
civis.Response
- idint
The ID of this Csv Export job.
- namestr
The name of this Csv Export job.
- source
civis.Response
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- source
- destination
civis.Response
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_path
civis.Response
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- storage_path
- destination
- include_headerbool
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint
The max file size, in MB, created files will be. Only available when force_multifile is true.
- my_permission_levelstr
Your permission level on the object. One of “read”, “write”, or “manage”.
- get_files_csv_runs(id: int, run_id: int) Response
Check status of a run
- Parameters:
- idint
The ID of the CSV Export job.
- run_idint
The ID of the run.
- Returns:
civis.Response
id : int
state : str
- created_atstr (time)
The time that the run was queued.
- started_atstr (time)
The time that the run started.
- finished_atstr (time)
The time that the run completed.
- errorstr
The error message for this run, if present.
- output_cached_onstr (time)
The time that the output was originally exported, if a cache entry was used by the run.
- list(*, type: str = None, status: str = None, author: str = None, hidden: bool = None, archived: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None) list[Response] | PaginatedResponse
List
- Parameters:
- typestr, optional
If specified, return exports of these types. It accepts a comma-separated list, possible values are ‘database’ and ‘gdoc’.
- statusstr, optional
If specified, returns export with one of these statuses. It accepts a comma-separated list, possible values are ‘running’, ‘failed’, ‘succeeded’, ‘idle’, ‘scheduled’.
- authorstr, optional
If specified, return items from any of these authors. It accepts a comma- separated list of user IDs.
- hiddenbool, optional
If specified to be true, returns hidden items. Defaults to false, returning non-hidden items.
- archivedstr, optional
The archival status of the requested item(s).
- limitint, optional
Number of results to return. Defaults to 20. Maximum allowed is 50.
- page_numint, optional
Page number of the results to return. Defaults to the first page, 1.
- orderstr, 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_dirstr, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
- iteratorbool, optional
If True, return a generator (specifically, a
civis.PaginatedResponse
object) to iterate over all responses. Use it when more results than the maximum allowed by ‘limit’ are needed. When True, ‘page_num’ is ignored. If False, return a list ofcivis.Response
objects, whose size is determined by ‘limit’. Defaults to False.
- Returns:
civis.PaginatedResponse
- idint
The ID for this export.
- namestr
The name of this export.
- typestr
The type of export.
- created_atstr (time)
The creation time for this export.
- updated_atstr (time)
The last modification time for this export.
state : str
- last_run
civis.Response
id : int
state : str
- created_atstr (time)
The time that the run was queued.
- started_atstr (time)
The time that the run started.
- finished_atstr (time)
The time that the run completed.
- errorstr
The error message for this run, if present.
- last_run
- author
civis.Response
- idint
The ID of this user.
- namestr
This user’s name.
- usernamestr
This user’s username.
- initialsstr
This user’s initials.
- onlinebool
Whether this user is online.
- author
- list_files_csv_runs(id: int, *, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None) list[Response] | PaginatedResponse
List runs for the given CSV Export job
- Parameters:
- idint
The ID of the CSV Export job.
- limitint, optional
Number of results to return. Defaults to 20. Maximum allowed is 100.
- page_numint, optional
Page number of the results to return. Defaults to the first page, 1.
- orderstr, optional
The field on which to order the result set. Defaults to id. Must be one of: id.
- order_dirstr, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
- iteratorbool, optional
If True, return a generator (specifically, a
civis.PaginatedResponse
object) to iterate over all responses. Use it when more results than the maximum allowed by ‘limit’ are needed. When True, ‘page_num’ is ignored. If False, return a list ofcivis.Response
objects, whose size is determined by ‘limit’. Defaults to False.
- Returns:
civis.PaginatedResponse
id : int
state : str
- created_atstr (time)
The time that the run was queued.
- started_atstr (time)
The time that the run started.
- finished_atstr (time)
The time that the run completed.
- errorstr
The error message for this run, if present.
- list_files_csv_runs_logs(id: int, run_id: int, *, last_id: int = None, limit: int = None) Response
Get the logs for a run
- Parameters:
- idint
The ID of the CSV Export job.
- run_idint
The ID of the run.
- last_idint, 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.
- limitint, optional
The maximum number of log messages to return. Default of 10000.
- Returns:
civis.Response
- idint
The ID of the log.
- created_atstr (date-time)
The time the log was created.
- messagestr
The log message.
- levelstr
The level of the log. One of unknown,fatal,error,warn,info,debug.
- list_files_csv_runs_outputs(id: int, run_id: int, *, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None) list[Response] | PaginatedResponse
List the outputs for a run
- Parameters:
- idint
The ID of the csv_export.
- run_idint
The ID of the run.
- limitint, optional
Number of results to return. Defaults to its maximum of 50.
- page_numint, optional
Page number of the results to return. Defaults to the first page, 1.
- orderstr, optional
The field on which to order the result set. Defaults to created_at. Must be one of: created_at, id.
- order_dirstr, optional
Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.
- iteratorbool, optional
If True, return a generator (specifically, a
civis.PaginatedResponse
object) to iterate over all responses. Use it when more results than the maximum allowed by ‘limit’ are needed. When True, ‘page_num’ is ignored. If False, return a list ofcivis.Response
objects, whose size is determined by ‘limit’. Defaults to False.
- Returns:
civis.PaginatedResponse
- object_typestr
The type of the output. Valid values are File, Table, Report, Project, Credential, or JSONValue
- object_idint
The ID of the output.
- namestr
The name of the output.
- linkstr
The hypermedia link to the output.
value : object
- patch_files_csv(id: int, *, name: str = None, source: dict = None, destination: dict = None, include_header: bool = None, compression: str = None, column_delimiter: str = None, hidden: bool = None, force_multifile: bool = None, max_file_size: int = None) Response
Update some attributes of this CSV Export
- Parameters:
- idint
The ID of this Csv Export job.
- namestr, optional
The name of this Csv Export job.
- sourcedict, optional
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- destinationdict, optional
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_pathdict
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- include_headerbool, optional
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr, optional
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr, optional
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool, optional
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool, optional
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint, optional
The max file size, in MB, created files will be. Only available when force_multifile is true.
- Returns:
civis.Response
- idint
The ID of this Csv Export job.
- namestr
The name of this Csv Export job.
- source
civis.Response
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- source
- destination
civis.Response
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_path
civis.Response
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- storage_path
- destination
- include_headerbool
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint
The max file size, in MB, created files will be. Only available when force_multifile is true.
- my_permission_levelstr
Your permission level on the object. One of “read”, “write”, or “manage”.
- post_files_csv(source: dict, destination: dict, *, name: str = None, include_header: bool = None, compression: str = None, column_delimiter: str = None, hidden: bool = None, force_multifile: bool = None, max_file_size: int = None) Response
Create a CSV Export
- Parameters:
- sourcedict
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- destinationdict
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_pathdict
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- namestr, optional
The name of this Csv Export job.
- include_headerbool, optional
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr, optional
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr, optional
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool, optional
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool, optional
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint, optional
The max file size, in MB, created files will be. Only available when force_multifile is true.
- Returns:
civis.Response
- idint
The ID of this Csv Export job.
- namestr
The name of this Csv Export job.
- source
civis.Response
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- source
- destination
civis.Response
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_path
civis.Response
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- storage_path
- destination
- include_headerbool
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint
The max file size, in MB, created files will be. Only available when force_multifile is true.
- my_permission_levelstr
Your permission level on the object. One of “read”, “write”, or “manage”.
- post_files_csv_runs(id: int) Response
Start a run
- Parameters:
- idint
The ID of the CSV Export job.
- Returns:
civis.Response
id : int
state : str
- created_atstr (time)
The time that the run was queued.
- started_atstr (time)
The time that the run started.
- finished_atstr (time)
The time that the run completed.
- errorstr
The error message for this run, if present.
- output_cached_onstr (time)
The time that the output was originally exported, if a cache entry was used by the run.
- put_files_csv(id: int, source: dict, destination: dict, *, name: str = None, include_header: bool = None, compression: str = None, column_delimiter: str = None, hidden: bool = None, force_multifile: bool = None, max_file_size: int = None) Response
Replace all attributes of this CSV Export
- Parameters:
- idint
The ID of this Csv Export job.
- sourcedict
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- destinationdict
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_pathdict
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- namestr, optional
The name of this Csv Export job.
- include_headerbool, optional
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr, optional
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr, optional
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool, optional
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool, optional
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint, optional
The max file size, in MB, created files will be. Only available when force_multifile is true.
- Returns:
civis.Response
- idint
The ID of this Csv Export job.
- namestr
The name of this Csv Export job.
- source
civis.Response
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- source
- destination
civis.Response
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_path
civis.Response
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- storage_path
- destination
- include_headerbool
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint
The max file size, in MB, created files will be. Only available when force_multifile is true.
- my_permission_levelstr
Your permission level on the object. One of “read”, “write”, or “manage”.
- put_files_csv_archive(id: int, status: bool) Response
Update the archive status of this object
- Parameters:
- idint
The ID of the object.
- statusbool
The desired archived status of the object.
- Returns:
civis.Response
- idint
The ID of this Csv Export job.
- namestr
The name of this Csv Export job.
- source
civis.Response
- sqlstr
The SQL query for this Csv Export job
- remote_host_idint
The ID of the destination database host.
- credential_idint
The ID of the credentials for the destination database.
- source
- destination
civis.Response
- filename_prefixstr
The prefix of the name of the file returned to the user.
- storage_path
civis.Response
- file_pathstr
The path within the bucket where the exported file will be saved. E.g. the file_path for “s3://mybucket/files/all/” would be “/files/all/”
- storage_host_idint
The ID of the destination storage host.
- credential_idint
The ID of the credentials for the destination storage host.
- existing_filesstr
Notifies the job of what to do in the case that the exported file already exists at the provided path.One of: fail, append, overwrite. Default: fail. If “append” is specified,the new file will always be added to the provided path. If “overwrite” is specifiedall existing files at the provided path will be deleted and the new file will be added.By default, or if “fail” is specified, the export will fail if a file exists at the provided path.
- storage_path
- destination
- include_headerbool
A boolean value indicating whether or not the header should be included. Defaults to true.
- compressionstr
The compression of the output file. Valid arguments are “gzip” and “none”. Defaults to “gzip”.
- column_delimiterstr
The column delimiter for the output file. Valid arguments are “comma”, “tab”, and “pipe”. Defaults to “comma”.
- hiddenbool
A boolean value indicating whether or not this request should be hidden. Defaults to false.
- force_multifilebool
Whether or not the csv should be split into multiple files. Default: false
- max_file_sizeint
The max file size, in MB, created files will be. Only available when force_multifile is true.
- my_permission_levelstr
Your permission level on the object. One of “read”, “write”, or “manage”.