client.scripts.put_dbt

A method of the Scripts endpoint.

put_dbt(id: int, name: str, repo_http_uri: str, *, parent_id: int = None, user_context: str = None, params: List[dict] = None, arguments: dict = None, schedule: dict = None, notifications: dict = None, next_run_at: str = None, time_zone: str = None, target_project_id: int = None, required_resources: dict = None, instance_type: str = None, cancel_timeout: int = None, docker_image_tag: str = None, partition_label: str = None, running_as_id: int = None, dbt_project: dict = None, repo_ref: str = None, target_database: dict = None) Response

Replace all attributes of this dbt Script

API URL: PUT /scripts/dbt/{id}

import civis
client = civis.APIClient()
response = client.scripts.put_dbt(...)
Parameters:
idint

The ID for the script.

namestr

The name of the script.

repo_http_uristr

The URL of the git repository (e.g., https://github.com/organization/repo_name.git).

parent_idint, optional

The ID of the parent job that will trigger this script

user_contextstr, optional

“runner” or “author”, who to execute the script as when run as a template.

paramsList[dict], optional

A definition of the parameters this script accepts in the arguments field.

  • namestr

    The variable’s name as used within your code.

  • labelstr

    The label to present to users when asking them for the value.

  • descriptionstr

    A short sentence or fragment describing this parameter to the end user.

  • typestr

    The type of parameter. Valid options: string, multi_line_string, integer, float, bool, file, table, database, credential_aws, credential_redshift, or credential_custom

  • requiredbool

    Whether this param is required.

  • valueobject

    The value you would like to set this param to. Setting this value makes this parameter a fixed param.

  • defaultstr

    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.

  • allowed_valuesList[dict]

    The possible values this parameter can take, effectively making this an enumerable parameter. Allowed values is an array of hashes of the following format: {label: ‘Import’, ‘value’: ‘import’}

argumentsdict, optional

Parameter-value pairs to use when running this script. Only settable if this script has defined parameters.

scheduledict, optional
  • scheduledbool

    If the item is scheduled.

  • scheduled_daysList[int]

    Days of the week, based on numeric value starting at 0 for Sunday. Mutually exclusive with scheduledDaysOfMonth

  • scheduled_hoursList[int]

    Hours of the day it is scheduled on.

  • scheduled_minutesList[int]

    Minutes of the day it is scheduled on.

  • scheduled_runs_per_hourint

    Deprecated in favor of scheduled minutes.

  • scheduled_days_of_monthList[int]

    Days of the month it is scheduled on, mutually exclusive with scheduledDays.

notificationsdict, optional
  • urlsList[str]

    URLs to receive a POST request at job completion

  • success_email_subjectstr

    Custom subject line for success e-mail.

  • success_email_bodystr

    Custom body text for success e-mail, written in Markdown.

  • success_email_addressesList[str]

    Addresses to notify by e-mail when the job completes successfully.

  • success_email_from_namestr

    Name from which success emails are sent; defaults to “Civis.”

  • success_email_reply_tostr

    Address for replies to success emails; defaults to the author of the job.

  • failure_email_addressesList[str]

    Addresses to notify by e-mail when the job fails.

  • stall_warning_minutesint

    Stall warning emails will be sent after this amount of minutes.

  • success_onbool

    If success email notifications are on. Defaults to user’s preferences.

  • failure_onbool

    If failure email notifications are on. Defaults to user’s preferences.

next_run_atstr (time), optional

The time of the next scheduled run.

time_zonestr, optional

The time zone of this script.

target_project_idint, optional

Target project to which script outputs will be added.

required_resourcesdict, optional
  • cpuint

    The number of CPU shares to allocate for the container. Each core has 1000 shares. Must be at least 2 shares.

  • memoryint

    The amount of RAM to allocate for the container (in MB). Must be at least 4 MB.

  • disk_spacefloat (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.

instance_typestr, optional

The EC2 instance type to deploy to. Only available for jobs running on kubernetes.

cancel_timeoutint, optional

The amount of time (in seconds) to wait before forcibly terminating the script. When the script is cancelled, it is first sent a TERM signal. If the script is still running after the timeout, it is sent a KILL signal. Defaults to 0.

docker_image_tagstr, optional

The tag of the docker image to pull from DockerHub.

partition_labelstr, optional

The partition label used to run this object.

running_as_idint, optional

The ID of the runner of this script.

dbt_projectdict, optional
  • targetstr

    Which profile target to use. Ignored when used in conjunction with generate_profiles.

  • schemastr

    The output schema for dbt to use.

  • project_dirstr

    The path to dbt_project.yml. Defaults to the root of the repository. Generates ‘DBT_PROJECT_DIR’ environment variable.

  • profiles_dirstr

    The path to the profiles.yml file to be used by dbt. Ignored when used in conjunction with generate_profiles. Generates ‘DBT_PROFILES_DIR’ environment variable.

  • dbt_versionstr

    The version of dbt to use. Generates ‘DBT_VERSION’ environment variable.

  • dbt_commandstr

    The primary dbt command to run. Valid commands are build, run, test, compile, and retry.

  • dbt_command_line_argsstr

    Additional command line arguments to pass to dbt. Ignored when dbt retry command is selected.

  • docs_report_idstr

    The ID of the HTML report hosting the static dbt docs for this job. Updates every time a run succeeds. This report will be automatically shared with all users who are shared on the job.

  • skip_docs_generationbool

    Whether to skip dbt docs generation. If true, the linked docs report will not be updated when the script runs. Defaults to false.

  • generate_profilesbool

    Whether to generate the profiles.yml file when running the script. Defaults to false.

repo_refstr, optional

A git reference specifying an unambiguous version of the file. Can be a branch name, a tag, or the full or shortened SHA of a commit. Defaults to ‘main’.

target_databasedict, optional
  • remote_host_idint

    The remote host ID that this script will connect to.

  • credential_idint

    The credential that this script will use.

Returns:
civis.Response
  • idint

    The ID for the script.

  • namestr

    The name of the script.

  • typestr

    The type of the script (e.g SQL, Container, Python, R, JavaScript, dbt)

  • created_atstr (time)

    The time this script was created.

  • updated_atstr (time)

    The time the script was last updated.

  • authorcivis.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.

  • statestr

    The status of the script’s last run.

  • finished_atstr (time)

    The time that the script’s last run finished.

  • categorystr

    The category of the script.

  • projectsList[civis.Response]

    A list of projects containing the script.

    • idint

      The ID for the project.

    • namestr

      The name of the project.

  • parent_idint

    The ID of the parent job that will trigger this script

  • user_contextstr

    “runner” or “author”, who to execute the script as when run as a template.

  • paramsList[civis.Response]

    A definition of the parameters this script accepts in the arguments field.

    • namestr

      The variable’s name as used within your code.

    • labelstr

      The label to present to users when asking them for the value.

    • descriptionstr

      A short sentence or fragment describing this parameter to the end user.

    • typestr

      The type of parameter. Valid options: string, multi_line_string, integer, float, bool, file, table, database, credential_aws, credential_redshift, or credential_custom

    • requiredbool

      Whether this param is required.

    • valueobject

      The value you would like to set this param to. Setting this value makes this parameter a fixed param.

    • defaultstr

      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.

    • allowed_valuesList[civis.Response]

      The possible values this parameter can take, effectively making this an enumerable parameter. Allowed values is an array of hashes of the following format: {label: ‘Import’, ‘value’: ‘import’}

  • argumentscivis.Response

    Parameter-value pairs to use when running this script. Only settable if this script has defined parameters.

  • is_templatebool

    Whether others scripts use this one as a template.

  • published_as_template_idint

    The ID of the template that this script is backing.

  • from_template_idint

    The ID of the template this script uses, if any.

  • template_dependents_countint

    How many other scripts use this one as a template.

  • template_script_namestr

    The name of the template script.

  • linkscivis.Response
    • detailsstr

      The details link to get more information about the script.

    • runsstr

      The runs link to get the run information list for this script.

  • schedulecivis.Response
    • scheduledbool

      If the item is scheduled.

    • scheduled_daysList[int]

      Days of the week, based on numeric value starting at 0 for Sunday. Mutually exclusive with scheduledDaysOfMonth

    • scheduled_hoursList[int]

      Hours of the day it is scheduled on.

    • scheduled_minutesList[int]

      Minutes of the day it is scheduled on.

    • scheduled_runs_per_hourint

      Deprecated in favor of scheduled minutes.

    • scheduled_days_of_monthList[int]

      Days of the month it is scheduled on, mutually exclusive with scheduledDays.

  • notificationscivis.Response
    • urlsList[str]

      URLs to receive a POST request at job completion

    • success_email_subjectstr

      Custom subject line for success e-mail.

    • success_email_bodystr

      Custom body text for success e-mail, written in Markdown.

    • success_email_addressesList[str]

      Addresses to notify by e-mail when the job completes successfully.

    • success_email_from_namestr

      Name from which success emails are sent; defaults to “Civis.”

    • success_email_reply_tostr

      Address for replies to success emails; defaults to the author of the job.

    • failure_email_addressesList[str]

      Addresses to notify by e-mail when the job fails.

    • stall_warning_minutesint

      Stall warning emails will be sent after this amount of minutes.

    • success_onbool

      If success email notifications are on. Defaults to user’s preferences.

    • failure_onbool

      If failure email notifications are on. Defaults to user’s preferences.

  • running_ascivis.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.

  • next_run_atstr (time)

    The time of the next scheduled run.

  • time_zonestr

    The time zone of this script.

  • last_runcivis.Response
    • id : int

    • statestr

      The state of the run. One of queued, running, succeeded, failed or cancelled.

    • 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.

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • hiddenbool

    The hidden status of the item.

  • target_project_idint

    Target project to which script outputs will be added.

  • archivedbool

    The archival status of the requested item(s).

  • required_resourcescivis.Response
    • cpuint

      The number of CPU shares to allocate for the container. Each core has 1000 shares. Must be at least 2 shares.

    • memoryint

      The amount of RAM to allocate for the container (in MB). Must be at least 4 MB.

    • disk_spacefloat (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.

  • instance_typestr

    The EC2 instance type to deploy to. Only available for jobs running on kubernetes.

  • cancel_timeoutint

    The amount of time (in seconds) to wait before forcibly terminating the script. When the script is cancelled, it is first sent a TERM signal. If the script is still running after the timeout, it is sent a KILL signal. Defaults to 0.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub.

  • partition_labelstr

    The partition label used to run this object.

  • running_as_idint

    The ID of the runner of this script.

  • dbt_projectcivis.Response
    • targetstr

      Which profile target to use. Ignored when used in conjunction with generate_profiles.

    • schemastr

      The output schema for dbt to use.

    • project_dirstr

      The path to dbt_project.yml. Defaults to the root of the repository. Generates ‘DBT_PROJECT_DIR’ environment variable.

    • profiles_dirstr

      The path to the profiles.yml file to be used by dbt. Ignored when used in conjunction with generate_profiles. Generates ‘DBT_PROFILES_DIR’ environment variable.

    • dbt_versionstr

      The version of dbt to use. Generates ‘DBT_VERSION’ environment variable.

    • dbt_commandstr

      The primary dbt command to run. Valid commands are build, run, test, compile, and retry.

    • dbt_command_line_argsstr

      Additional command line arguments to pass to dbt. Ignored when dbt retry command is selected.

    • docs_report_idstr

      The ID of the HTML report hosting the static dbt docs for this job. Updates every time a run succeeds. This report will be automatically shared with all users who are shared on the job.

    • skip_docs_generationbool

      Whether to skip dbt docs generation. If true, the linked docs report will not be updated when the script runs. Defaults to false.

    • generate_profilesbool

      Whether to generate the profiles.yml file when running the script. Defaults to false.

  • repo_http_uristr

    The URL of the git repository (e.g., https://github.com/organization/repo_name.git).

  • repo_refstr

    A git reference specifying an unambiguous version of the file. Can be a branch name, a tag, or the full or shortened SHA of a commit. Defaults to ‘main’.

  • target_databasecivis.Response
    • remote_host_idint

      The remote host ID that this script will connect to.

    • credential_idint

      The credential that this script will use.