Commit graph

787 commits

Author SHA1 Message Date
Pablo Martin
15139e00d0 percentage test 2024-09-13 15:20:39 +02:00
Pablo Martin
8c96b96ee5 small comment 2024-09-13 15:20:39 +02:00
Pablo Martin
6136db8403 cte for pre-defining if vat is applicable or not 2024-09-13 15:20:39 +02:00
Pablo Martin
f58e97a3f2 set references for v1 2024-09-13 15:20:39 +02:00
Pablo Martin
2cd115eede remove unnecessary alias, remove unrelated errors in yaml 2024-09-13 15:20:39 +02:00
Pablo Martin
1974da99f7 fix typos 2024-09-13 15:20:39 +02:00
Pablo Martin
d4b797c741 add alias 2024-09-13 15:20:39 +02:00
Pablo Martin
4efc1ba50f v1 goes back to original state 2024-09-13 15:20:39 +02:00
Pablo Martin
bbb9558f62 yaml for new version, plus deprecation 2024-09-13 15:20:39 +02:00
Pablo Martin
4ba6c80d6f v2 model 2024-09-13 15:20:15 +02:00
Pablo Martin
bde6f12404 add new columns 2024-09-13 15:20:15 +02:00
Pablo Martin
0aaec6a619 fuck around with Uri 2024-09-13 15:20:15 +02:00
Pablo Martín
ac1aed029d Merged PR 2832: Format YAML on save + complements
# Description

This PR:
- Adds some `vscode` settings that make VSCode autoformat yaml files on save, like we do with `.sql` files. This should help with formatting consistency.
- I also made some notes about this on the readme.
- Finally, I made a couple of tiny unrelated changes on the readme since I was there.

Related work items: #21344
2024-09-13 08:33:26 +00:00
Pablo Martin
1043c9e80b final files 2024-09-12 15:41:34 +02:00
Pablo Martin
df16cdb00c reporting schema 2024-09-12 15:39:49 +02:00
Pablo Martin
05d5cc6d10 fix schemas in intermediate 2024-09-12 15:38:50 +02:00
Pablo Martin
aabb45dbd5 format files in staging 2024-09-12 15:36:15 +02:00
Pablo Martin
8fdb88afc7 update readme 2024-09-12 15:35:13 +02:00
Pablo Martin
51275b9513 add autoformat on save 2024-09-12 15:25:45 +02:00
Oriol Roqué Paniagua
2295679fc9 Merged PR 2828: Exposing Deal info to reporting
# Description

Exposes the 2 new deal fields to reporting to make it accessible for PBI

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Exposing Deal info to reporting

Related work items: #18911, #19083
2024-09-12 12:29:37 +00:00
uri
0e94022544 Exposing Deal info to reporting 2024-09-12 14:08:36 +02:00
Oriol Roqué Paniagua
c336081d3d Merged PR 2825: Propagates deal Name and Billing Country in int_monthly_aggregated_metrics_history_by_deal
# Description

Changes (only in intermediate):
* Applies sqlfmt in KPIs source models (for some of them it was already applied). Specifically, the 3 Core models ONLY contains formatting changes
![image.png](https://guardhog.visualstudio.com/4148d95f-4b6d-4205-bcff-e9c8e0d2ca65/_apis/git/repositories/54ac356f-aad7-46d2-b62c-e8c5b3bb8ebf/pullRequests/2825/attachments/image.png)

* Adds `main_deal_name` and `main_billing_country_iso_3_per_deal` in `int_monthly_aggregated_metrics_history_by_deal`

* Adds the 2 new fields in the schema entry of `int_monthly_aggregated_metrics_history_by_deal`, including the dbt test not null in the deal name.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #18911, #19083
2024-09-12 12:04:04 +00:00
Oriol Roqué Paniagua
72c966631e Merged PR 2824: Propagates Billing Country and Deal Name into int_dates_by_deal
# Description

Changes:
* Adding `main_deal_name` and `main_billing_country_iso_3_per_deal` in `int_dates_by_deal` model.
* Documents the 2 new fields. Also, ensures `main_deal_name` is not null
* Removes `id_deal not null` condition since it's enforced on the inner join with `int_core__deal`

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #18911, #19083
2024-09-12 10:27:56 +00:00
Joaquin Ossa
83d98c59b1 Merged PR 2796: Fixed model that wasn't mapping correctly
# Description

Fixed model that wasn't mapping correctly because I am dumb

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [x] I have checked for DRY opportunities with other models and docs.
- [x] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Fixed model that wasn't mapping correctly

Related work items: #20125
2024-09-10 10:30:08 +00:00
Joaquin Ossa
91296fa91c Fixed model that wasn't mapping correctly 2024-09-10 12:09:16 +02:00
Joaquin Ossa
d5151e2e90 Merged PR 2788: Update edeposit users table
# Description

Created a mapping for some users that have a different id in Cosmos so we can join them using data that Ray shared with me, with this we can get all currency information for each user

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [x] I have checked for DRY opportunities with other models and docs.
- [x] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20125
2024-09-10 08:35:37 +00:00
Joaquin Ossa
6ed48a39fc Included explanation in schema 2024-09-09 18:36:13 +02:00
Joaquin Ossa
a54bc78c53 Fixed mapping 2024-09-09 18:32:25 +02:00
Joaquin Ossa
7ea70d3f4c Update of users table 2024-09-09 17:51:06 +02:00
Pablo Martín
2733adfd31 Merged PR 2774: Inline CTEs on int_core__mtd_booking_metrics
# Description

This PR is a pure refactor (as in, doesn't change the output of the model at all).

The only purpose of the changes in this PR is to improve the performance on the model. The strategy to achieve this has been to inline the basic CTEs of the model (inline=replace references to the CTE with direct `ref` inside the model).

This works because it breaks an optimization fence.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20835
2024-09-09 12:55:24 +00:00
Oriol Roqué Paniagua
599f00093e Merged PR 2760: Adding latest_date_is_yesterday test
# Description

Adds a new dbt test that will fail if the maximum date of a given column is different from yesterday. It uses `current_date`.

Additionally, I changed the test `kpis_global_metrics_outlier_detection` on the name of the parameter `detector_strength` to `detector_tolerance`, as a higher value of the parameter indicates that will be less likely to raise an alert.

Verified in local that tests passes if the execution is normal. Verified in local that the tests fails if manually deleting the latest date in the table.

# Checklist - Does not apply

- [ ] The edited models and dependants run properly with production data.
- [ ] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20824
2024-09-09 12:52:53 +00:00
Oriol Roqué Paniagua
3bef513443 Merged PR 2768: Specifying sqlfmt instructions to follow for dbt Power User
# Description

Updated link to use for dbt Power User usage with sqlfmt

# Checklist (N/A)

- [ ] The edited models and dependants run properly with production data.
- [ ] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Specifying sqlfmt instructions to follow for dbt Power User

Related work items: #20860
2024-09-09 12:51:47 +00:00
Pablo Martin
afaceefe88 comment a bit more 2024-09-09 12:31:34 +02:00
Oriol Roqué Paniagua
6daec3135c Merged PR 2770: First version of name unification for a deal
# Description

This PR aims to add a new field in the master table of deals, `int_core__deal`, to incorporate the name of the account/client in a new field called `main_deal_name`.

Since a deal can have several accounts and there's no deal name existing in the backend, I just use `first_name`, `last_name` and `company_name` as the sources for the potential names. With some character removal via regex, I take the name that gets repeated the most within certain obvious exceptions (i.e., no "Bookings", "LLC", etc).

This is opinionated and could be done differently, happy to hear your thoughts.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #18911
2024-09-09 10:23:03 +00:00
Pablo Martin
c22a840084 inline the CTEs of the model 2024-09-09 12:05:44 +02:00
uri
f18a2eb520 First version of name unification for a deal 2024-09-06 17:08:50 +02:00
uri
8756d21d8c Specifying sqlfmt instructions to follow for dbt Power User 2024-09-06 15:46:19 +02:00
Joaquin Ossa
cb1f00849d Updated exposures for E-deposit 2024-09-06 09:16:14 +02:00
uri
cb8beab129 Modifying strenght by tolerance to clarify naming 2024-09-06 09:15:33 +02:00
uri
0f73b70942 Adding new column test: latest_date_is_yesterday 2024-09-06 09:13:27 +02:00
Joaquin Ossa
1e89966153 Merged PR 2756: guesty_verifications model
# Description

I added verification status to be able to show the amount of bookings that have been approved vs not approved (rejected, flagged, or missing info)

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [x] I have checked for DRY opportunities with other models and docs.
- [x] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20125
2024-09-05 15:32:43 +00:00
Joaquin Ossa
7036b24847 guesty_verifications model 2024-09-05 17:21:48 +02:00
Oriol Roqué Paniagua
00a97a3aff Merged PR 2755: Exposes By Billing Country dimension in KPIs to production
# Description

Parameter configuration to show the new dimension now that tests are implemented and look ok.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #19082, #20827
2024-09-05 14:55:30 +00:00
Pablo Martín
f553e73089 Merged PR 2753: Remove distincts from booking counts
# Description

This PR removes multiple `distinct` statements from counts on the booking metrics.

I'm doing this:
- Because they are making the model query perform terribly, and it's already starting to be way too slow.
- They are not that necessary since the uniqueness of the fields being `distinct`-ed it's already tested in upstream models.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20835
2024-09-05 14:54:50 +00:00
uri
836be7903b Fix config - again 2024-09-05 16:34:17 +02:00
uri
05058f9e05 Fix - wrong config 2024-09-05 16:18:49 +02:00
uri
2662527790 Enable By Billing Country dimension in prod 2024-09-05 16:17:05 +02:00
Oriol Roqué Paniagua
4322206091 Merged PR 2752: Adding specific business tests for kpis
# Description

Adds 2 tests for KPIs to:
1. Check that the values observed in the last run for the dimensions other than Global are consistent for additive metrics. Consistent does not mean exact, though
2. Check that the values observed in the last run for Global dimension are similar to what was observed previously, to raise an alert in case of outliers. This one is tricky because there's possibilities to have false positives, so extensive documentation on the test and parameters has been provided.

Note: This runs well targeting production. It also detects the cancelled bookings issue if it was supposed to run on 31st of August. Once an alert is raised, since it only takes into account the last update, usually will not raise it in the next day.

# Checklist (does not apply)

- [ ] The edited models and dependants run properly with production data.
- [ ] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Adding specific business tests for kpis

Related work items: #20824
2024-09-05 14:01:58 +00:00
Pablo Martin
01c9c0d8ad remove distincts from booking counts 2024-09-05 15:17:45 +02:00
Joaquin Ossa
d7c8e2a84e Merged PR 2750: Changed model for bookings with 0 nights
# Description

Changed model for bookings with 0 nights

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [x] I have checked for DRY opportunities with other models and docs.
- [x] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20125
2024-09-05 12:27:50 +00:00