dating_platform/communications.view.lookml 19 dims2 measures 3 warnings Repo files

LookML view · dating-platform

The messages view: message value, reply flags and the filters every query inherits

At a glance

Does
Reads one row per message with sender, recipient, thread, proposition, type, state and reply flags, plus a numeric message_value. Measures: count and avg_message_value.Trust: Source-defined
Why
Supports messaging quality analysis: how often conversations start, how often messages get replies, and how valuable messages are by sender age and subscription.Trust: Inferred
Grain
One row per message. id is the primary key.Trust: Source-defined
Source
dating_platform/communications.view.lookml 84 lines
Source: communications.view.lookml L1-10
dating_platform/communications.view.lookmlL1-10
- view: messages  sql_table_name: ${TABLE}.messages  fields:  - dimension: original_message_id    hidden: true    type: int    sql: ${TABLE}.original_message_id  - dimension_group: created    type: time    timeframes:    - time    - date    - week

dating-platform, communications.view.lookml, lines 1-10

Shape

Trust: Source-defined

Every field as declared, with the dashboard tiles that read it. Computed from the source; nothing here is edited.

Table: ${TABLE}.messages

Dimensions 19

NameTypeSQLUsed byTags
original_message_idL4int${TABLE}.original_message_id-hidden
createdtime, date, week, monthL8time group${TABLE}.created_atMessage Activity
has_replyL16yesno${TABLE}.has_reply-
idL19int${TABLE}.id-primary key
is_conversation_starterL23yesno${TABLE}.is_conversation_starter-
proposition_idL26int${TABLE}.proposition_id-
recipient_account_ageL29int${TABLE}.recipient_account_age-
sender_account_ageL32int${TABLE}.sender_account_age (default)-implicit sql
recipient_idL34int${TABLE}.recipient_id-
sender_idL37int${TABLE}.sender_id-
sender_subscribedL40yesno${TABLE}.sender_subscribed-
sourceL43string${TABLE}.source-
stateL45string${TABLE}.state-
thread_idL47int${TABLE}.thread_id-
typeL50string${TABLE}.type-
updatedtime, date, week, monthL52time group${TABLE}.updated_at-
is_sent_within_24hrL60yesno(${sender_account_age}/60) < 24-hiddenderived
message_valueL64number${TABLE}.message_value-
message_value_with_24hrL68numberCASE WHEN ${TABLE}.message_value-derived

Measures 2

NameTypeSQLUsed byTags
countL74countCOUNT(*) of rowsMessage Activity
avg_message_valueL77avg${message_value}-derived

Relationships

Trust: Source-defined
Relationships of messages
Relationships of messages. Text version follows the diagram.This viewUsed by: explores, views, dashboardsbase viewas messages, on messages.proposition_id = propo...as messages, on messages.sender_id = user_metri...1 tile messages explore in enterprise propositions explore in enterprise tests explore in enterprise maps_dashboard dashboard
  • This Block
  • No relationship declared
Text version
  • messages is the base view of messages: base view
  • messages is joined into propositions: as messages, on messages.proposition_id = propo... (no relationship declared)
  • messages is joined into tests: as messages, on messages.sender_id = user_metri... (no relationship declared)
  • messages is read by maps_dashboard: 1 tile

Filters and exclusions that change meaning

Every explore query starts filtered

Trust: Source-defined

The messages explore in the enterprise model always excludes welcome messages and spammer senders and recipients, and starts at created_date: last week.

Source: enterprise.model.lookml L23-26
dating_platform/enterprise.model.lookmlL23-26
- explore: messages  view: messages  always_filter:    messages.type: -Messages::Welcome    recipient.is_spammer: false    sender.is_spammer: false    messages.created_date: last week  joins:  - join: sender    from: users

dating-platform, enterprise.model.lookml, lines 23-26

Worth noticing

Account age is assumed to be in minutes

Trust: Inferred

is_sent_within_24hr divides sender_account_age by 60 and compares it to 24. That means 24 hours only if the column is stored in minutes. The field is hidden.

Source: communications.view.lookml L60-63
dating_platform/communications.view.lookmlL60-63
    - week    - month    sql: ${TABLE}.updated_at  - dimension: is_sent_within_24hr    type: yesno    sql: (${sender_account_age}/60) < 24    hidden: true  - dimension: message_value    type: number    decimals: 10

dating-platform, communications.view.lookml, lines 60-63

sender_account_age has no sql

Trust: Source-defined

sender_account_age declares only type: int, so Looker reads the default column ${TABLE}.sender_account_age. Its neighbour recipient_account_age spells the column out.

Source: communications.view.lookml L29-33
dating_platform/communications.view.lookmlL29-33
  - dimension: proposition_id    type: int    sql: ${TABLE}.proposition_id  - dimension: recipient_account_age    type: int    sql: ${TABLE}.recipient_account_age  - dimension: sender_account_age    type: int  - dimension: recipient_id    type: int    sql: ${TABLE}.recipient_id

dating-platform, communications.view.lookml, lines 29-33

The table name uses the TABLE placeholder

Trust: Inferred

sql_table_name: ${TABLE}.messages puts ${TABLE} inside the definition of the table itself. It resolves only if something substitutes a schema there.

Source: communications.view.lookml L1-3
dating_platform/communications.view.lookmlL1-3
- view: messages  sql_table_name: ${TABLE}.messages  fields:  - dimension: original_message_id    hidden: true    type: int

dating-platform, communications.view.lookml, lines 1-3

What can change the answer 3

Blocker: message_value_with_24hr is unfinished SQL

Trust: Source-defined

The dimension's SQL is CASE WHEN ${TABLE}.message_value with no condition, THEN or END.

What goes wrong: Selecting the field breaks the whole query, including every other field in the same look.

Source: communications.view.lookml L68-73
dating_platform/communications.view.lookmlL68-73
    type: number    decimals: 10    sql: ${TABLE}.message_value  - dimension: message_value_with_24hr    type: number    decimals: 10    sql: |      CASE        WHEN ${TABLE}.message_value  - measure: count    type: count    detail: detail*

dating-platform, communications.view.lookml, lines 68-73

Caution: Default counts cover last week only

Trust: Source-defined

Because of the always_filter, count in the messages explore counts last week's non-welcome, non-spam messages unless the reader changes each filter value.

What goes wrong: Message volume from a fresh explore looks like weekly volume, and comparing it with monthly targets understates activity.

Read the guide: Filters that change metric meaning

Source: enterprise.model.lookml L23-26
dating_platform/enterprise.model.lookmlL23-26
- explore: messages  view: messages  always_filter:    messages.type: -Messages::Welcome    recipient.is_spammer: false    sender.is_spammer: false    messages.created_date: last week  joins:  - join: sender    from: users

dating-platform, enterprise.model.lookml, lines 23-26

Note: Sender and recipient joins expose sets that are not in the repo

Trust: Source-defined

The explore joins users twice, as sender and recipient, and limits each to a messages set that would live in the missing users view.

Read the guide: Missing tables and stale references

Source: enterprise.model.lookml L27-35
dating_platform/enterprise.model.lookmlL27-35
    recipient.is_spammer: false    sender.is_spammer: false    messages.created_date: last week  joins:  - join: sender    from: users    sql_foreign_key: sender_id    fields: sender.messages  - join: recipient    from: users    sql_foreign_key: recipient_id    fields: recipient.messages- explore: propositions  view: propositions  conditionally_filter:

dating-platform, enterprise.model.lookml, lines 27-35

Related

Guides built on this file

Related source files

Source model