This SQL query performs a series of transformations on data from a Qualtrics block table. It starts by selecting all columns from a temporary staging table, then defines a set of fields with specific data types. Finally, it renames and reorganizes these fields, including changing some column names for clarity (e.g., 'block_locking' to 'is_locked', 'id' to 'block_id'). The query doesn't filter, deduplicate, or aggregate data, but it does standardize the data types and structure of the output.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__block_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS block_locking,
CAST(NULL AS TEXT) AS block_visibility,
CAST(NULL AS TEXT) AS description,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TEXT) AS randomize_questions,
CAST(NULL AS TEXT) AS survey_id,
CAST(NULL AS TEXT) AS type,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
block_locking AS is_locked,
block_visibility,
description,
id AS block_id,
randomize_questions,
survey_id,
type,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
is_locked | integer | Boolean representing whether modification of the block and its contents is prevented. |
block_visibility | integer | Whether the questions in the block are 'collapsed' or 'expanded' by default. |
description | text | Description given to the block. |
block_id | text | The ID of the survey block. Match pattern = ^BL_[a-zA-Z0-9]{11,15}$ |
randomize_questions | integer | If/how the block questions are randomized. Can be - `false` (no randomization), `RandomWithXPerPage` (randomize all and place X questions in each block), `RandomWithOnlyX` (randomly present only X out of the total questions), or `Advanced` (custom configuration) |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
type | text | Type of block. Can be `Trash`, `Default`, or `Standard` |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query performs a basic data transformation on the 'stg_qualtrics__block_question_tmp' table. It casts specific columns to defined data types, renames some columns, and introduces a 'source_relation' column with an empty string value. The query doesn't perform any filtering, joining, or aggregation operations. It's primarily focused on standardizing the data structure and preparing it for further use.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__block_question_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS block_id,
CAST(NULL AS TEXT) AS question_id,
CAST(NULL AS TEXT) AS survey_id,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
block_id,
question_id,
survey_id,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
block_id | text | The ID of the survey block. Match pattern = ^BL_[a-zA-Z0-9]{11,15}$ |
question_id | text | The unique identifier for the question. Match pattern = ^QID[a-zA-Z0-9]+$ |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Qualtrics data related to block questions.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
block_id | text | None |
question_id | text | None |
survey_id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type, which is set to NULL. The query doesn't retrieve any actual data as it uses LIMIT 0.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
survey_id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
block_locking | integer | None |
block_visibility | integer | None |
description | text | None |
randomize_questions | integer | None |
type | text | None |
This SQL query performs data cleaning and transformation on the 'stg_qualtrics__contact_mailing_list_membership_tmp' table. It casts columns to specific data types, renames some columns, and restructures the data. The query doesn't filter, deduplicate, or aggregate data, but it does standardize the data format and structure.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__contact_mailing_list_membership_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS contact_id,
CAST(NULL AS TEXT) AS contact_lookup_id,
CAST(NULL AS TEXT) AS directory_id,
CAST(NULL AS TEXT) AS mailing_list_id,
CAST(NULL AS TEXT) AS name,
CAST(NULL AS TEXT) AS owner_id,
CAST(NULL AS TIMESTAMP) AS unsubscribe_date,
CAST(NULL AS BOOLEAN) AS unsubscribed,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
contact_id,
contact_lookup_id,
directory_id,
mailing_list_id,
name,
owner_id AS owner_user_id,
CAST(unsubscribe_date AS TIMESTAMP) AS unsubscribed_at,
unsubscribed AS is_unsubscribed,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
contact_id | text | The ID for the contact. Example - CID_012345678901234 |
contact_lookup_id | text | Optional contact lookup ID for individual distribution. |
directory_id | text | The directory ID, also known as a pool ID. Example - POOL_012345678901234 |
mailing_list_id | text | The ID for the mailing list. |
name | text | Name of the mailing list. |
owner_user_id | text | The unique identifier for a specific user who owns this. |
unsubscribed_at | timestamp without time zone | Date and time the user opted out of this mailing list. |
is_unsubscribed | boolean | Boolean indicating whether the contact has opted out of receiving email through this mailing list. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further development or testing purposes.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
contact_lookup_id | text | None |
_fivetran_synced | timestamp without time zone | None |
contact_id | text | None |
directory_id | text | None |
mailing_list_id | text | None |
name | text | None |
owner_id | text | None |
unsubscribe_date | timestamp without time zone | None |
unsubscribed | boolean | None |
This SQL query performs a series of transformations on data from a Qualtrics directory source. It starts by selecting all columns from a temporary staging table, then casts specific columns to appropriate data types, and finally renames and reorganizes the columns. The query also includes some boolean flags for deduplication criteria, though these are initially set to NULL. The purpose seems to be to standardize and prepare the Qualtrics directory data for further use or analysis.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__directory_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS BOOLEAN) AS deduplication_criteria_email,
CAST(NULL AS BOOLEAN) AS deduplication_criteria_external_data_reference,
CAST(NULL AS BOOLEAN) AS deduplication_criteria_first_name,
CAST(NULL AS BOOLEAN) AS deduplication_criteria_last_name,
CAST(NULL AS BOOLEAN) AS deduplication_criteria_phone,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS BOOLEAN) AS is_default,
CAST(NULL AS TEXT) AS name,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
deduplication_criteria_email AS is_deduped_on_email,
deduplication_criteria_external_data_reference AS is_deduped_on_ext_ref,
deduplication_criteria_first_name AS is_deduped_on_first_name,
deduplication_criteria_last_name AS is_deduped_on_last_name,
deduplication_criteria_phone AS is_deduped_on_phone,
id AS directory_id,
is_default,
name,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
is_deduped_on_email | boolean | Boolean representing if directory contacts are deduped based on email. |
is_deduped_on_ext_ref | boolean | Boolean representing if directory contacts are deduped based on an external data reference. |
is_deduped_on_first_name | boolean | Boolean representing if directory contacts are deduped based on first name. |
is_deduped_on_last_name | boolean | Boolean representing if directory contacts are deduped based on last name. |
is_deduped_on_phone | boolean | Boolean representing if directory contacts are deduped based on phone number. |
directory_id | text | The directory ID, also known as a pool ID. Example - POOL_012345678901234 |
is_default | boolean | Boolean representing if this directory is the default one for your brand. The default directory will be the first directory listed in the dropdown menu in Qualtrics. |
name | text | Name of the directory. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query stages data from a temporary Qualtrics directory contact table. It performs type casting, standardizes email and phone formats, and renames some columns. The query also adds a source relation column and structures the final output.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__directory_contact_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TIMESTAMP) AS creation_date,
CAST(NULL AS TEXT) AS directory_id,
CAST(NULL AS TIMESTAMP) AS directory_unsubscribe_date,
CAST(NULL AS BOOLEAN) AS directory_unsubscribed,
CAST(NULL AS TEXT) AS email,
CAST(NULL AS TEXT) AS email_domain,
CAST(NULL AS TEXT) AS ext_ref,
CAST(NULL AS TEXT) AS first_name,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TEXT) AS language,
CAST(NULL AS TIMESTAMP) AS last_modified,
CAST(NULL AS TEXT) AS last_name,
CAST(NULL AS TEXT) AS phone,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
CAST(creation_date AS TIMESTAMP) AS created_at,
directory_id,
CAST(directory_unsubscribe_date AS TIMESTAMP) AS unsubscribed_from_directory_at,
directory_unsubscribed AS is_unsubscribed_from_directory,
LOWER(email) AS email,
LOWER(email_domain) AS email_domain,
ext_ref,
first_name,
last_name,
REGEXP_REPLACE(phone, '[^0-9]', '') AS phone, /* remove any non-numeric chars */
id AS contact_id,
language,
CAST(last_modified AS TIMESTAMP) AS last_modified_at,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
created_at | timestamp without time zone | The creation date and time of the record, expressed as an ISO 8601 value. |
directory_id | text | The directory ID, also known as a pool ID. Example - POOL_012345678901234 |
unsubscribed_from_directory_at | timestamp without time zone | Date and time the user opted out of the directory. |
is_unsubscribed_from_directory | boolean | Boolean indicating whether the contact unsubscribed from all contact from the Directory. |
text | Contact's email address. Must be in proper email format. | |
email_domain | text | Domain of the contact's email address. |
ext_ref | integer | The external reference for the contact. |
first_name | text | Contact's first name. |
contact_id | text | The ID for the contact. Example - CID_012345678901234 |
language | integer | The user's default language. |
last_modified_at | timestamp without time zone | The point in time when the record was last modified. |
last_name | text | Contact's surname. |
phone | text | Contact's phone number. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for further development or testing purposes.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
directory_id | text | None |
id | text | None |
_fivetran_synced | timestamp without time zone | None |
creation_date | text | None |
directory_unsubscribe_date | timestamp without time zone | None |
directory_unsubscribed | boolean | None |
text | None | |
email_domain | text | None |
embedded_data_last_active_time | integer | None |
embedded_data_last_response_date | integer | None |
embedded_data_login_date | integer | None |
ext_ref | integer | None |
first_name | text | None |
language | integer | None |
last_modified | text | None |
last_name | text | None |
phone | character varying | None |
write_blanks | integer | None |
This SQL query stages data from a temporary table for a Qualtrics directory mailing list. It casts columns to specific data types, renames some columns, and prepares the data for further processing. The query doesn't perform any filtering, deduplication, or aggregation, but focuses on cleaning and standardizing the data structure.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__directory_mailing_list_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TIMESTAMP) AS creation_date,
CAST(NULL AS TEXT) AS directory_id,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TIMESTAMP) AS last_modified_date,
CAST(NULL AS TEXT) AS name,
CAST(NULL AS TEXT) AS owner_id,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
CAST(creation_date AS TIMESTAMP) AS created_at,
directory_id,
id AS mailing_list_id,
CAST(last_modified_date AS TIMESTAMP) AS last_modified_at,
name,
owner_id AS owner_user_id,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
created_at | timestamp without time zone | The creation date and time of the record, expressed as an ISO 8601 value. |
directory_id | text | The directory ID, also known as a pool ID. Example - POOL_012345678901234 |
mailing_list_id | text | The ID for the mailing list. |
last_modified_at | timestamp without time zone | The point in time when the record was last modified. |
name | text | Name of the mailing list. |
owner_user_id | text | The unique identifier for a specific user who owns this. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further development or testing purposes in a dbt (data build tool) project, specifically for a staging model related to Qualtrics directory mailing lists.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
directory_id | text | None |
id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
creation_date | text | None |
last_modified_date | text | None |
name | text | None |
owner_id | text | None |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) project, particularly for staging Qualtrics directory data.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
deduplication_criteria_email | boolean | None |
deduplication_criteria_external_data_reference | boolean | None |
deduplication_criteria_first_name | boolean | None |
deduplication_criteria_last_name | boolean | None |
deduplication_criteria_phone | boolean | None |
is_default | boolean | None |
name | text | None |
This SQL query performs data transformation and cleaning on a Qualtrics distribution dataset. It starts by selecting all columns from a temporary staging table, then casts each column to a specific data type in the 'fields' CTE. The 'final' CTE renames some columns, adjusts data types (especially for date/time fields), and selects the transformed columns. The query primarily focuses on standardizing data types and column names to prepare the data for further analysis or integration into a data warehouse.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__distribution_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TIMESTAMP) AS created_date,
CAST(NULL AS TEXT) AS header_from_email,
CAST(NULL AS TEXT) AS header_from_name,
CAST(NULL AS TEXT) AS header_reply_to_email,
CAST(NULL AS TEXT) AS header_subject,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TEXT) AS message_library_id,
CAST(NULL AS TEXT) AS message_message_id,
CAST(NULL AS TEXT) AS message_message_text,
CAST(NULL AS TIMESTAMP) AS modified_date,
CAST(NULL AS TEXT) AS organization_id,
CAST(NULL AS TEXT) AS owner_id,
CAST(NULL AS TEXT) AS parent_distribution_id,
CAST(NULL AS TEXT) AS recipient_contact_id,
CAST(NULL AS TEXT) AS recipient_library_id,
CAST(NULL AS TEXT) AS recipient_mailing_list_id,
CAST(NULL AS TEXT) AS recipient_sample_id,
CAST(NULL AS TEXT) AS request_status,
CAST(NULL AS TEXT) AS request_type,
CAST(NULL AS TIMESTAMP) AS send_date,
CAST(NULL AS TIMESTAMP) AS survey_link_expiration_date,
CAST(NULL AS TEXT) AS survey_link_link_type,
CAST(NULL AS TEXT) AS survey_link_survey_id,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
CAST(created_date AS TIMESTAMP) AS created_at,
header_from_email,
header_from_name,
header_reply_to_email,
header_subject,
id AS distribution_id,
message_library_id,
message_message_id AS message_id,
message_message_text AS message_text,
CAST(modified_date AS TIMESTAMP) AS last_modified_at,
organization_id,
owner_id AS owner_user_id,
parent_distribution_id,
recipient_contact_id,
recipient_library_id,
recipient_mailing_list_id,
recipient_sample_id,
request_status,
request_type,
CAST(send_date AS TIMESTAMP) AS send_at,
CAST(survey_link_expiration_date AS TIMESTAMP) AS survey_link_expires_at,
survey_link_link_type AS survey_link_type,
survey_link_survey_id AS survey_id,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
created_at | timestamp without time zone | The creation date and time of the record, expressed as an ISO 8601 value. |
header_from_email | text | Email from address. |
header_from_name | text | Email from name. |
header_reply_to_email | text | Email reply-to address. |
header_subject | text | Email subject; text or message id (MS_). |
distribution_id | text | The unique Distribution ID. |
message_library_id | integer | Library ID of the message. |
message_id | integer | The ID for the desired library message. |
message_text | integer | Text of the message to send. |
last_modified_at | timestamp without time zone | The point in time when the record was last modified. |
organization_id | text | ID of the organization/brand this record belongs to. |
owner_user_id | text | The unique identifier for a specific user who owns this. |
parent_distribution_id | integer | The unique ID of the parent distribution. |
recipient_contact_id | text | The contact ID of the recipient. Can point to `directory_contact` or `core_contact`. |
recipient_library_id | text | Library ID of the message. |
recipient_mailing_list_id | text | The mailing list or contact group associated with the distribution(s). Can point to `directory_mailing_list` or `core_mailing_list`. |
recipient_sample_id | text | The ID for the desired sample. Can point to `directory_sample` or `core_sample` (not included in package). |
request_status | text | The distribution's status. States include `Pending` and `Done`. The Pending state is for email that is scheduled to be sent at a later time. |
request_type | text | The distribution's type. Types include `Invite`, `Reminder`, and `ThankYou`. |
send_at | timestamp without time zone | The date and time the request will be or was sent (in ISO 8601 format). Note that this date and time could be in the future if the email distribution is scheduled to send after a delay. |
survey_link_expires_at | timestamp without time zone | The expiration date for the link associated with the survey distribution. Null if `request_type` != `Invite`. |
survey_link_type | text | The link type (`Individual`, `Anonymous`, or `Multiple`) for the link associated with the survey distribution. Null if `request_type` != `Invite`. |
survey_id | text | The unique survey ID. Will be non-null even if `request_type` != `Invite`. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query performs a basic staging operation on the Qualtrics distribution contact data. It starts by selecting all columns from a temporary table, then defines a set of fields with specific data types (mostly casting to NULL or empty string). Finally, it selects these fields, casting some timestamp fields explicitly, and creates the final output. The query doesn't perform any complex transformations, filtering, or aggregations; it's primarily focused on structuring the data with defined data types.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__distribution_contact_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS contact_frequency_rule_id,
CAST(NULL AS TEXT) AS contact_id,
CAST(NULL AS TEXT) AS contact_lookup_id,
CAST(NULL AS TEXT) AS distribution_id,
CAST(NULL AS TIMESTAMP) AS opened_at,
CAST(NULL AS TIMESTAMP) AS response_completed_at,
CAST(NULL AS TEXT) AS response_id,
CAST(NULL AS TIMESTAMP) AS response_started_at,
CAST(NULL AS TIMESTAMP) AS sent_at,
CAST(NULL AS TEXT) AS status,
CAST(NULL AS TEXT) AS survey_link,
CAST(NULL AS TEXT) AS survey_session_id,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
contact_frequency_rule_id,
contact_id,
contact_lookup_id,
distribution_id,
CAST(opened_at AS TIMESTAMP) AS opened_at,
CAST(response_completed_at AS TIMESTAMP) AS response_completed_at,
response_id,
CAST(response_started_at AS TIMESTAMP) AS response_started_at,
CAST(sent_at AS TIMESTAMP) AS sent_at,
status,
survey_link,
survey_session_id,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
contact_frequency_rule_id | integer | The contact frequency Rule ID. Ex - FQ_AAB234234 |
contact_id | text | The ID for the contact. Example - CID_012345678901234 |
contact_lookup_id | text | Optional contact lookup ID for individual distribution. |
distribution_id | text | The unique Distribution ID. |
opened_at | timestamp without time zone | The time a survey was opened by the respondent, will be null if the survey has not been opened. |
response_completed_at | timestamp without time zone | The time a response was completed, will be null for uncompleted surveys. |
response_id | integer | The ID of the survey response submitted by this contact. If no survey response has been submitted, this value will be null. If the survey was setup to anonymize responses, then this value will be `Anonymous`. |
response_started_at | timestamp without time zone | The time a response was started by the respondent, will be null if survey has not been started. |
sent_at | timestamp without time zone | The time a survey was sent to the respondent. |
status | text | One of ([full descriptions](https://api.qualtrics.com/fc8017650d0b9-distribution-status)): - `Pending` - `Success` - `Error` - `Opened` - `Complaint` - `Skipped` - `Blocked` - `Failure` - `Unknown` - `SoftBounce` - `HardBounce` - `SurveyStarted` - `SurveyPartiallyFinished` - `SurveyFinished` - `SurveyScreenedOut` - `SessionExpired` |
survey_link | text | The survey link sent with the distribution. This is null when no link was sent. |
survey_session_id | integer | An identifier that represents the session in which the respondent interacted with the survey |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Qualtrics distribution contact data.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
contact_id | text | None |
distribution_id | text | None |
_fivetran_synced | timestamp without time zone | None |
contact_frequency_rule_id | integer | None |
contact_lookup_id | text | None |
opened_at | text | None |
response_completed_at | timestamp without time zone | None |
response_id | integer | None |
response_started_at | timestamp without time zone | None |
sent_at | text | None |
status | text | None |
survey_link | text | None |
survey_session_id | integer | None |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, initialized to NULL. The LIMIT 0 clause ensures no rows are returned. This query is likely used as a template or placeholder in a dbt (data build tool) project, specifically for the 'model.qualtrics_source.stg_qualtrics__distribution_tmp' model.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
created_date | text | None |
header_from_email | text | None |
header_from_name | text | None |
header_reply_to_email | text | None |
header_subject | text | None |
message_library_id | integer | None |
message_message_id | integer | None |
message_message_text | integer | None |
modified_date | text | None |
organization_id | text | None |
owner_id | text | None |
parent_distribution_id | integer | None |
recipient_contact_id | text | None |
recipient_library_id | text | None |
recipient_mailing_list_id | text | None |
recipient_sample_id | text | None |
request_status | text | None |
request_type | text | None |
send_date | text | None |
survey_link_expiration_date | text | None |
survey_link_link_type | text | None |
survey_link_survey_id | text | None |
This SQL query performs a series of transformations on data from a temporary staging table for Qualtrics questions. It casts columns to specific data types, renames some columns, and selects a subset of columns for the final output. The query doesn't filter, deduplicate, or aggregate data, but rather focuses on cleaning and restructuring the data for downstream use.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__question_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS data_export_tag,
CAST(NULL AS BOOLEAN) AS data_visibility_hidden,
CAST(NULL AS BOOLEAN) AS data_visibility_private,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS INT) AS next_answer_id,
CAST(NULL AS INT) AS next_choice_id,
CAST(NULL AS TEXT) AS question_description,
CAST(NULL AS TEXT) AS question_description_option,
CAST(NULL AS TEXT) AS question_text,
CAST(NULL AS TEXT) AS question_text_unsafe,
CAST(NULL AS TEXT) AS question_type,
CAST(NULL AS TEXT) AS selector,
CAST(NULL AS TEXT) AS sub_selector,
CAST(NULL AS TEXT) AS survey_id,
CAST(NULL AS TEXT) AS validation_setting_force_response,
CAST(NULL AS TEXT) AS validation_setting_force_response_type,
CAST(NULL AS TEXT) AS validation_setting_type,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
data_export_tag,
data_visibility_hidden AS is_data_hidden,
data_visibility_private AS is_data_private,
id AS question_id,
next_answer_id,
next_choice_id,
question_description,
question_description_option,
question_text,
question_text_unsafe,
question_type,
selector,
sub_selector,
survey_id,
validation_setting_force_response,
validation_setting_force_response_type,
validation_setting_type,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
data_export_tag | text | The tag to identify the question in exported data. |
is_data_hidden | boolean | Boolean that represents whether the embedded data is hidden. |
is_data_private | boolean | Boolean that represents whether the embedded data is private. |
question_id | text | The unique identifier for the question. Match pattern = ^QID[a-zA-Z0-9]+$ |
next_answer_id | integer | For Matrix questions, the vertical options are denoted as "Answers" in the question's structure. ID of the next answer for this question. ? |
next_choice_id | integer | For Matrix questions, the horizontal options are denoted as "Choices" in the question's structure. ID of the next choice for this question. ? |
question_description | text | Label to identify the question. |
question_description_option | text | An optional user-provided field for question descriptions. Accepted values = `UseText`, `SpecifyLabel` |
question_text | text | Text for the question. |
question_text_unsafe | text | Un-paresed version of the question text. |
question_type | text | The type of question. Can be - `MC`,`Matrix`,`Captcha`,`CS`,`DB`,`DD`,`Draw`,`DynamicMatrix`,`FileUpload`,`GAP`,`HeatMap`,`HL`,`HotSpot`,`Meta`,`PGR`,`RO`,`SBS`,`Slider`,`SS`,`TE`,`Timing`,`TreeSelect` |
selector | text | How answers are selected such as single answer, multiple answer, etc. Accepted values - - `Bipolar` - `Browser` - `Captcha` - `CompactView` - `CS` - `D` - `DL` - `DND` - `DragAndDrop` - `ESTB` - `FORM` - `FileUpload` - `GRB` - `HBAR` - `HR` - `HSLIDER` - `I` - `Image` - `LikeDislike` - `Likert` - `MACOL` - `MAHR` - `MAVR` - `ML` - `MSB` - `MaxDiff` - `NPS` - `OH` - `OnOff` - `POS` - `PTB` - `PW` - `PageTimer` - `Profile` - `RB` - `RO` - `SACOL` - `SAHR` - `SAVR` - `SB` - `SBSMatrix` - `SL` - `STAR` - `ScreenCapture` - `SearchOnly` - `Signature` - `TA` - `TB` - `TBelow` - `TE` - `TL` - `TRight` - `Text` - `V1` - `V2` - `VR` - `VRTL` - `WTXB` |
sub_selector | text | How subquestion answers are selected. Allowed values - SingleAnswer, DL, GR, DND, Long, Medium, MultipleAnswer, Columns, NoColumns, Short, TX, TXOT, WOTXB, WOTB, WTB, WTXB, WVTB. |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
validation_setting_force_response | integer | The response from forcing respondents to answer a question or request that they consider answering the question before leaving the page |
validation_setting_force_response_type | integer | The type of response from forcing respondents to answer a question or request that they consider answering the question before leaving the page |
validation_setting_type | text | The type of forced response validation that is set. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query is primarily focused on data cleaning and restructuring. It starts by selecting all columns from a temporary staging table, then defines a set of fields with specific data types and default values. The final step renames and reorganizes these fields, including renaming '_fivetran_deleted' to 'is_deleted'. The query doesn't perform any filtering, deduplication, featurization, integration, or aggregation.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__question_option_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS key,
CAST(NULL AS TEXT) AS question_id,
CAST(NULL AS TEXT) AS recode_value,
CAST(NULL AS TEXT) AS survey_id,
CAST(NULL AS TEXT) AS text,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
question_id,
survey_id,
key,
recode_value,
text,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
key | integer | The key of the `QUESTION_OPTION` that was chosen. |
question_id | text | The unique identifier for the question. Match pattern = ^QID[a-zA-Z0-9]+$ |
recode_value | integer | Recode/mapping value for the option. |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
text | text | Question option text. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) model.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
key | integer | None |
question_id | text | None |
survey_id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
recode_value | integer | None |
text | text | None |
This SQL query creates a staging table for Qualtrics question responses. It starts by selecting all columns from a temporary table, then defines a set of fields with specific data types (mostly TEXT and one TIMESTAMP). The query then selects these fields in a specific order, effectively restructuring and potentially type-casting the data from the source table. The 'source_relation' field is explicitly set to an empty string.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__question_response_tmp
), fields AS (
SELECT
CAST(NULL AS TEXT) AS _fivetran_id,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS loop_id,
CAST(NULL AS TEXT) AS question,
CAST(NULL AS TEXT) AS question_id,
CAST(NULL AS TEXT) AS question_option_key,
CAST(NULL AS TEXT) AS response_id,
CAST(NULL AS TEXT) AS sub_question_key,
CAST(NULL AS TEXT) AS sub_question_text,
CAST(NULL AS TEXT) AS value,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
_fivetran_id,
loop_id,
question_id,
question,
question_option_key,
response_id,
sub_question_key,
sub_question_text,
value,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
_fivetran_id | text | Fivetran-generated unique key hashed on `response_id`, `question_id`, `sub_question_key`, `sub_question_text` , `question_option_key` , `loop_id` and `importId`. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
loop_id | integer | ID of the [Loop and Merge](https://www.qualtrics.com/support/survey-platform/survey-module/block-options/loop-and-merge/) object this response is associated with. |
question | text | Question text. |
question_id | text | The unique identifier for the question. Match pattern = ^QID[a-zA-Z0-9]+$ |
question_option_key | integer | The key of the `QUESTION_OPTION` that was chosen. |
response_id | text | The unique ID for the `SURVEY_RESPONSE`. |
sub_question_key | integer | Key of the sub question. |
sub_question_text | integer | Sub question text. |
value | integer | Value of the question response. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further development or testing purposes.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
_fivetran_id | text | None |
_fivetran_synced | timestamp without time zone | None |
loop_id | integer | None |
question | text | None |
question_id | text | None |
question_option_key | integer | None |
response_id | text | None |
sub_question_key | integer | None |
sub_question_text | integer | None |
value | integer | None |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further development or testing purposes.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
survey_id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
data_export_tag | text | None |
data_visibility_hidden | boolean | None |
data_visibility_private | boolean | None |
next_answer_id | integer | None |
next_choice_id | integer | None |
question_description | text | None |
question_description_option | text | None |
question_text | text | None |
question_text_unsafe | text | None |
question_type | text | None |
selector | text | None |
sub_selector | text | None |
validation_setting_force_response | integer | None |
validation_setting_force_response_type | integer | None |
validation_setting_type | text | None |
This SQL query performs a basic transformation on data from a staging table. It casts several columns to specific data types, renames the '_fivetran_deleted' column to 'is_deleted', and selects a subset of columns for the final output. The query doesn't perform any filtering, deduplication, featurization, integration, or aggregation.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__sub_question_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS choice_data_export_tag,
CAST(NULL AS TEXT) AS key,
CAST(NULL AS TEXT) AS question_id,
CAST(NULL AS TEXT) AS survey_id,
CAST(NULL AS TEXT) AS text,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
choice_data_export_tag,
key,
question_id,
survey_id,
text,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
choice_data_export_tag | integer | The tag to identify the question choice in exported data. |
key | integer | Key of the sub question. |
question_id | text | The unique identifier for the question. Match pattern = ^QID[a-zA-Z0-9]+$ |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
text | text | Sub question text. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query is limited to 0 rows, effectively producing no output. This type of query is often used as a placeholder or template in data modeling tools like dbt.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
key | integer | None |
question_id | text | None |
survey_id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
choice_data_export_tag | integer | None |
text | text | None |
This SQL query performs a series of data transformations on the 'stg_qualtrics__survey' table. It starts by selecting all columns from a temporary table, then explicitly casts all fields to specific data types in the 'fields' CTE. Finally, it renames some columns, adjusts data types for timestamp fields, and selects all transformed columns in the 'final' CTE. The query focuses on cleaning and standardizing the data structure.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__survey_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS auto_scoring_category,
CAST(NULL AS TEXT) AS brand_base_url,
CAST(NULL AS TEXT) AS brand_id,
CAST(NULL AS TEXT) AS bundle_short_name,
CAST(NULL AS TEXT) AS composition_type,
CAST(NULL AS TEXT) AS creator_id,
CAST(NULL AS TEXT) AS default_scoring_category,
CAST(NULL AS TEXT) AS division_id,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TIMESTAMP) AS last_accessed,
CAST(NULL AS TIMESTAMP) AS last_activated,
CAST(NULL AS TIMESTAMP) AS last_modified,
CAST(NULL AS TEXT) AS owner_id,
CAST(NULL AS TEXT) AS project_category,
CAST(NULL AS TEXT) AS project_type,
CAST(NULL AS TEXT) AS registry_sha,
CAST(NULL AS TEXT) AS registry_version,
CAST(NULL AS TEXT) AS schema_version,
CAST(NULL AS BOOLEAN) AS scoring_summary_after_questions,
CAST(NULL AS BOOLEAN) AS scoring_summary_after_survey,
CAST(NULL AS TEXT) AS scoring_summary_category,
CAST(NULL AS TEXT) AS survey_name,
CAST(NULL AS TEXT) AS survey_status,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
id AS survey_id,
survey_name,
survey_status,
brand_base_url,
brand_id,
bundle_short_name,
composition_type,
auto_scoring_category,
default_scoring_category,
division_id,
creator_id AS creator_user_id,
owner_id AS owner_user_id,
project_category,
project_type,
registry_sha,
registry_version,
schema_version,
scoring_summary_after_questions,
scoring_summary_after_survey,
scoring_summary_category,
CAST(last_accessed AS TIMESTAMP) AS last_accessed_at,
CAST(last_activated AS TIMESTAMP) AS last_activated_at,
CAST(last_modified AS TIMESTAMP) AS last_modified_at,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
auto_scoring_category | integer | The automated scoring category. |
brand_base_url | text | Base url for the organization/brand. |
brand_id | text | Unique ID of the organization/brand. |
bundle_short_name | integer | Short name for the content bundle that the survey is from. |
composition_type | integer | Survey composition type. |
creator_user_id | integer | The unique identifier for a specific `USER` who created the survey. |
default_scoring_category | integer | The default scoring category. |
division_id | integer | The unique identifier for the Division ID. Match pattern = ^DV_[0-9a-zA-Z]{11,15}$ |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
last_accessed_at | timestamp without time zone | The date the survey was last accessed. |
last_activated_at | timestamp without time zone | The date the survey was last activated. |
last_modified_at | timestamp without time zone | The point in time when the record was last modified. |
owner_user_id | text | The unique identifier for a specific user who owns this. |
project_category | text | Project category of the survey. Allowed values - `CORE`, `CX`, `EX`, `BX`, `PX` |
project_type | text | Type of [Qualtrics project](https://www.qualtrics.com/support/survey-platform/my-projects/my-projects-overview/#SelectingProjectType). Match pattern = ^[a-zA-Z]+$ |
registry_sha | integer | The survey registry SHA. |
registry_version | integer | The survey registry version. |
schema_version | integer | Qualtrics schema version. |
scoring_summary_after_questions | boolean | Boolean representing whether the scoring summary is after questions. |
scoring_summary_after_survey | boolean | Boolean representing whether the scoring summary is after the survey. |
scoring_summary_category | integer | The unique identifier for the scoring. |
survey_name | text | Name of the survey. |
survey_status | text | The distribution status of the survey, or a flag indicating that it's a library block Allowed values - `Inactive`, `Active`, `Pending`, `LibBlock`, `Deactive`, `Temporary` |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates a staging table for Qualtrics survey embedded data. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a fields CTE that casts specific columns to appropriate data types, including setting default values. Finally, it selects and reorders these fields in the final CTE. The query essentially prepares and structures the data for further use, casting data types and providing a consistent schema.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__survey_embedded_data_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS import_id,
CAST(NULL AS TEXT) AS key,
CAST(NULL AS TEXT) AS response_id,
CAST(NULL AS TEXT) AS value,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
import_id,
key,
response_id,
value,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
import_id | text | A unique identifier to recognize this import job of embedded survey data. |
key | text | Key of the embedded survey data element. |
response_id | text | The unique ID for the `SURVEY_RESPONSE`. |
value | integer | Key of the embedded survey data element. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Qualtrics survey embedded data.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
import_id | text | None |
key | text | None |
response_id | text | None |
value | integer | None |
_fivetran_synced | timestamp without time zone | None |
This SQL query stages data from a Qualtrics survey response source table. It performs type casting, renames some columns, and applies minor transformations such as converting the 'finished' column to a boolean and lowercasing the recipient email. The query also includes a placeholder for a source relation column.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__survey_response_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TEXT) AS distribution_channel,
CAST(NULL AS INT) AS duration_in_seconds,
CAST(NULL AS TIMESTAMP) AS end_date,
CAST(NULL AS INT) AS finished,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TEXT) AS ip_address,
CAST(NULL AS TIMESTAMP) AS last_modified_date,
CAST(NULL AS FLOAT) AS location_latitude,
CAST(NULL AS FLOAT) AS location_longitude,
CAST(NULL AS INT) AS progress,
CAST(NULL AS TEXT) AS recipient_email,
CAST(NULL AS TEXT) AS recipient_first_name,
CAST(NULL AS TEXT) AS recipient_last_name,
CAST(NULL AS TIMESTAMP) AS recorded_date,
CAST(NULL AS TIMESTAMP) AS start_date,
CAST(NULL AS INT) AS status,
CAST(NULL AS TEXT) AS survey_id,
CAST(NULL AS TEXT) AS user_language,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
distribution_channel,
duration_in_seconds,
CAST(end_date AS TIMESTAMP) AS finished_at,
CAST(CASE WHEN finished = 1 THEN TRUE ELSE FALSE END AS BOOLEAN) AS is_finished,
id AS response_id,
ip_address,
CAST(last_modified_date AS TIMESTAMP) AS last_modified_at,
location_latitude,
location_longitude,
progress,
LOWER(recipient_email) AS recipient_email,
recipient_first_name,
recipient_last_name,
CAST(recorded_date AS TIMESTAMP) AS recorded_date,
CAST(start_date AS TIMESTAMP) AS started_at,
status,
survey_id,
user_language,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
distribution_channel | text | The method by which the survey was distributed to respondents. |
duration_in_seconds | integer | How long it took for the respondent to finish the survey in seconds. |
finished_at | timestamp without time zone | The point in time when the survey response was finished. |
is_finished | boolean | Boolean (stored as int) indicating if the respondent finished and submitted the survey, the value will be 1, otherwise it will be 0. |
response_id | text | The unique ID for the `SURVEY_RESPONSE`. |
ip_address | text | IP address of the recipient. |
last_modified_at | timestamp without time zone | The point in time when the record was last modified. |
location_latitude | integer | The approximate location of the respondent at the time the survey was taken. |
location_longitude | integer | The approximate location of the respondent at the time the survey was taken. |
progress | integer | How far the respondent has progressed through the survey as a percentage out of 100. |
recipient_email | text | Email of the [recipient](https://api.qualtrics.com/ZG9jOjg3NzY2OQ-getting-information-about-distributions#the-recipients-object) if they are a single recipient (not a mailing list or sample). |
recipient_first_name | text | First name of the [recipient](https://api.qualtrics.com/ZG9jOjg3NzY2OQ-getting-information-about-distributions#the-recipients-object) if they are a single recipient (not a mailing list or sample). |
recipient_last_name | text | Last name of the [recipient](https://api.qualtrics.com/ZG9jOjg3NzY2OQ-getting-information-about-distributions#the-recipients-object) if they are a single recipient (not a mailing list or sample). |
recorded_date | timestamp without time zone | The point in time when the survey response was recorded. |
started_at | timestamp without time zone | The point in time when the survey response was recorded. |
status | integer | The type of response. |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
user_language | text | The language of the respondent. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The LIMIT 0 clause ensures no rows are returned. This query appears to be used as a template or placeholder, possibly for testing or initialization purposes in a dbt (data build tool) project.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
_fivetran_synced | timestamp without time zone | None |
distribution_channel | text | None |
duration_in_seconds | integer | None |
end_date | text | None |
finished | integer | None |
ip_address | text | None |
last_modified_date | text | None |
location_latitude | integer | None |
location_longitude | integer | None |
progress | integer | None |
recipient_email | text | None |
recipient_first_name | text | None |
recipient_last_name | text | None |
recorded_date | text | None |
start_date | text | None |
status | integer | None |
survey_id | text | None |
user_language | text | None |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The LIMIT 0 clause ensures that no rows are returned. This type of query is often used as a placeholder or to define a schema structure without actually populating data.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
auto_scoring_category | integer | None |
brand_base_url | text | None |
brand_id | text | None |
bundle_short_name | integer | None |
composition_type | integer | None |
creator_id | integer | None |
default_scoring_category | integer | None |
division_id | integer | None |
is_active | integer | None |
last_accessed | timestamp without time zone | None |
last_activated | text | None |
last_modified | text | None |
option_active_response_set | text | None |
option_anonymize_response | integer | None |
option_auto_confirm_start | integer | None |
option_autoadvance | boolean | None |
option_autoadvance_pages | boolean | None |
option_autofocus | boolean | None |
option_available_languages | integer | None |
option_back_button | boolean | None |
option_ballot_box_stuffing_prevention | boolean | None |
option_collect_geo_location | integer | None |
option_confirm_start | integer | None |
option_custom_styles | text | None |
option_email_thank_you | integer | None |
option_eosredirect_url | integer | None |
option_highlight_questions | text | None |
option_inactive_survey | integer | None |
option_new_scoring | integer | None |
option_next_button | text | None |
option_no_index | text | None |
option_page_transition | text | None |
option_partial_data | text | None |
option_partial_data_close_after | integer | None |
option_password_protection | integer | None |
option_previous_button | text | None |
option_progress_bar_display | text | None |
option_protect_selection_ids | integer | None |
option_recaptcha_v_3 | integer | None |
option_referer_check | integer | None |
option_referer_url | integer | None |
option_relevant_id | integer | None |
option_relevant_idlockout_period | integer | None |
option_response_summary | integer | None |
option_save_and_continue | boolean | None |
option_secure_response_files | boolean | None |
option_show_export_tags | integer | None |
option_skin | text | None |
option_skin_library | text | None |
option_skin_question_width | integer | None |
option_skin_type | text | None |
option_survey_creation_date | text | None |
option_survey_expiration | text | None |
option_survey_language | text | None |
option_survey_meta_description | integer | None |
option_survey_name | integer | None |
option_survey_protection | text | None |
option_survey_termination | text | None |
option_survey_title | text | None |
option_validate_message | integer | None |
owner_id | text | None |
project_category | text | None |
project_type | text | None |
registry_sha | integer | None |
registry_version | integer | None |
schema_version | integer | None |
scoring_summary_after_questions | boolean | None |
scoring_summary_after_survey | boolean | None |
scoring_summary_category | integer | None |
survey_name | text | None |
survey_status | text | None |
This SQL query stages data from a temporary table (stg_qualtrics__survey_version_tmp) by casting columns to specific data types, renaming some columns, and selecting a subset of columns for the final output. It primarily focuses on cleaning and structuring the data for further use.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__survey_version_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TIMESTAMP) AS creation_date,
CAST(NULL AS TEXT) AS description,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS BOOLEAN) AS published,
CAST(NULL AS TEXT) AS survey_id,
CAST(NULL AS TEXT) AS user_id,
CAST(NULL AS INT) AS version_number,
CAST(NULL AS BOOLEAN) AS was_published,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
CAST(creation_date AS TIMESTAMP) AS created_at,
description AS version_description,
id AS version_id,
published AS is_published,
survey_id,
user_id AS publisher_user_id,
version_number,
was_published,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
created_at | timestamp without time zone | The creation date and time of the record, expressed as an ISO 8601 value. |
version_description | text | A user-provided description of the survey version. |
version_id | integer | The unique identifier for this survey version. |
is_published | boolean | Boolean that, when true, publishes the version. |
survey_id | text | The unique identifier for this survey. Match pattern = ^SV_[a-zA-Z0-9]{11,15}$ |
publisher_user_id | text | ID of `USER` who published this survey version in your org. |
version_number | integer | The version number of this survey. |
was_published | boolean | Boolean that is true if the survey version was published. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It doesn't perform any actual data manipulation or retrieval from the 'model.qualtrics_source.stg_qualtrics__survey_version_tmp' model. The query is likely used as a placeholder or template for generating a schema without any data.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | integer | None |
survey_id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
creation_date | text | None |
description | text | None |
published | boolean | None |
user_id | text | None |
version_number | integer | None |
was_published | boolean | None |
This SQL query performs data cleaning and transformation on the 'stg_qualtrics__user' table. It starts by casting all fields to specific data types, then renames some columns, and adjusts data types for timestamp fields. The query also renames some boolean fields for clarity (e.g., 'unsubscribed' to 'is_unsubscribed'). Finally, it selects all transformed fields into a final output.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_qualtrics_source.stg_qualtrics__user_tmp
), fields AS (
SELECT
CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS TIMESTAMP) AS account_creation_date,
CAST(NULL AS TIMESTAMP) AS account_expiration_date,
CAST(NULL AS TEXT) AS account_status,
CAST(NULL AS TEXT) AS division_id,
CAST(NULL AS TEXT) AS email,
CAST(NULL AS TEXT) AS first_name,
CAST(NULL AS TEXT) AS id,
CAST(NULL AS TEXT) AS language,
CAST(NULL AS TIMESTAMP) AS last_login_date,
CAST(NULL AS TEXT) AS last_name,
CAST(NULL AS TEXT) AS organization_id,
CAST(NULL AS TIMESTAMP) AS password_expiration_date,
CAST(NULL AS TIMESTAMP) AS password_last_changed_date,
CAST(NULL AS INT) AS response_count_auditable,
CAST(NULL AS INT) AS response_count_deleted,
CAST(NULL AS INT) AS response_count_generated,
CAST(NULL AS TEXT) AS time_zone,
CAST(NULL AS BOOLEAN) AS unsubscribed,
CAST(NULL AS TEXT) AS user_type,
CAST(NULL AS TEXT) AS username,
CAST('' AS TEXT) AS source_relation
FROM base
), final AS (
SELECT
CAST(account_creation_date AS TIMESTAMP) AS account_created_at,
CAST(account_expiration_date AS TIMESTAMP) AS account_expires_at,
account_status,
division_id,
email,
first_name,
id AS user_id,
language,
CAST(last_login_date AS TIMESTAMP) AS last_login_at,
last_name,
organization_id,
CAST(password_expiration_date AS TIMESTAMP) AS password_expires_at,
CAST(password_last_changed_date AS TIMESTAMP) AS password_last_changed_at,
response_count_auditable,
response_count_deleted,
response_count_generated,
time_zone,
unsubscribed AS is_unsubscribed,
user_type,
username,
_fivetran_deleted AS is_deleted,
_fivetran_synced,
source_relation
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
is_deleted | boolean | Boolean representing whether the record was soft-deleted in Qualtrics. |
_fivetran_synced | timestamp without time zone | The time when a record was last updated by Fivetran. |
account_created_at | timestamp without time zone | The date and time that the account was created. Dates and times are expressed in ISO 8601 format. |
account_expires_at | timestamp without time zone | The date the account expires. Dates and times are expressed in ISO 8601 format. |
account_status | text | Either `active`, `disabled`, or `notVerified`. |
division_id | integer | The unique identifier for the Division ID. Match pattern = ^DV_[0-9a-zA-Z]{11,15}$ |
text | The user's email address. | |
first_name | text | The user's first name or given name. |
user_id | text | Unique ID of the user. Match pattern = ^((UR)|(URH))_[0-9a-zA-Z]{11,15}$ |
language | integer | The user's default language. |
last_login_at | timestamp without time zone | The date and time the user last logged into the user interface. Dates and times are expressed in ISO 8601 format. |
last_name | text | User's surname. |
organization_id | integer | ID of the organization/brand this record belongs to. |
password_expires_at | timestamp without time zone | The date the account password expires. Dates and times are expressed in ISO 8601 format. |
password_last_changed_at | timestamp without time zone | The date the account password was last changed. Dates and times are expressed in ISO 8601 format. |
response_count_auditable | integer | The count of auditable responses. |
response_count_deleted | integer | The count of deleted responses. |
response_count_generated | integer | The count of generated responses. |
time_zone | integer | The IANA time zone setting for the user. |
is_unsubscribed | integer | Boolean indicating if the user unsubscribed. |
user_type | text | ID of the user type. See mappings of user types to their type IDs [here](https://api.qualtrics.com/dc2be1c61af61-user-type). |
username | text | UI-facing username for the account. |
source_relation | text | The schema or database this record came from if you are making use of the qualtrics_union_schemas or qualtrics_union_databases variables, respectively. Empty string if you are not using either of these variables to union together multiple Qualtrics connectors. |
This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further development or testing purposes in a dbt (data build tool) project.
OtherSELECT
CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
Name | Type | Comment |
---|---|---|
id | text | None |
_fivetran_deleted | boolean | None |
_fivetran_synced | timestamp without time zone | None |
account_creation_date | timestamp without time zone | None |
account_expiration_date | timestamp without time zone | None |
account_status | text | None |
division_id | integer | None |
text | None | |
first_name | text | None |
language | integer | None |
last_login_date | timestamp without time zone | None |
last_name | text | None |
organization_id | integer | None |
password_expiration_date | timestamp without time zone | None |
password_last_changed_date | timestamp without time zone | None |
response_count_auditable | integer | None |
response_count_deleted | integer | None |
response_count_generated | integer | None |
time_zone | integer | None |
unsubscribed | integer | None |
user_type | text | None |
username | text | None |