Initial publish of dbt_f2dq (f2dq) package v0.12.1.

Clean package repo for Gitea installs via packages.yml git URL.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
M7XBeast
2026-10-11 17:37:40 +03:00
co-authored by Cursor
commit ff096b51b5
188 changed files with 5251 additions and 0 deletions
@@ -0,0 +1,4 @@
select
{{ f2dq.clean_capitalize_words(f2dq.clean_additional_whitespaces('full_name')) }} as full_name,
{{ f2dq.clean_blacklist('email', ['^[a-zA-Z0-9_.+-]+'], '*****') }} as email
from {{ ref('sample_user_data') }}
@@ -0,0 +1,7 @@
version: 2
models:
- name: sanitized_user_data
tests:
- dbt_utils.equality:
compare_model: ref('expected_sample_user_data')
@@ -0,0 +1,16 @@
with x as
{{ f2dq.filter_remove_duplicates(
ref('duplicated'), ['transaction_id'], ['creation_time']) }}
select *, 'take_first' as use_case from x
union all
select *, 'take_last' as use_case from {{ f2dq.filter_remove_duplicates(
ref('duplicated'), ['transaction_id'], ['creation_time desc']) }} duplicates
union all
select *, 'take_all_statuses' as use_case from {{ f2dq.filter_remove_duplicates(
ref('duplicated'), ['transaction_id', 'status'], ['creation_time desc']) }} duplicates
@@ -0,0 +1,2 @@
{{ f2dq.filter_get_duplicates(
ref('duplicated'), ['transaction_id'], ['creation_time']) }}
@@ -0,0 +1,11 @@
version: 2
models:
- name: deduplicated
tests:
- dbt_utils.equality:
compare_model: ref('expected_deduplicated')
- name: duplicates
tests:
- dbt_utils.equality:
compare_model: ref('expected_duplicates')
@@ -0,0 +1,7 @@
version: 2
models:
- name: us_states_normalized
tests:
- dbt_utils.equality:
compare_model: ref('expected_us_states_normalized')
@@ -0,0 +1,29 @@
with us_states_normalization_cte as (
select source, target from {{ ref('us_states_normalization') }}
)
{% set us_states_mapping = {'Ala.': 'Alabama', 'Alaska': 'Alaska', 'Ariz.': 'Arizona', 'Ark.': 'Arkansas', 'Calif.': 'California', 'Colo.': 'Colorado', 'Conn.': 'Connecticut',
'Del.': 'Delaware', 'D.C.': 'District of Columbia', 'Fla.': 'Florida', 'Ga.': 'Georgia', 'Hawaii': 'Hawaii', 'Idaho': 'Idaho', 'Ill.': 'Illinois', 'Ind.': 'Indiana',
'Iowa': 'Iowa', 'Kans.': 'Kansas', 'Ky.': 'Kentucky', 'La.': 'Louisiana', 'Maine': 'Maine', 'Md.': 'Maryland', 'Mass.': 'Massachusetts', 'Mich.': 'Michigan',
'Minn.': 'Minnesota', 'Miss.': 'Mississippi', 'Mo.': 'Missouri', 'Mont.': 'Montana', 'Nebr.': 'Nebraska', 'Nev.': 'Nevada', 'N.H.': 'New Hampshire', 'N.J.': 'New Jersey',
'N.M.': 'New Mexico', 'N.Y.': 'New York', 'N.C.': 'North Carolina', 'N.D.': 'North Dakota', 'Ohio': 'Ohio', 'Okla.': 'Oklahoma', 'Ore.': 'Oregon', 'Pa.': 'Pennsylvania',
'R.I.': 'Rhode Island', 'S.C.': 'South Carolina', 'S.D.': 'South Dakota', 'Tenn.': 'Tennessee', 'Tex.': 'Texas', 'Utah': 'Utah', 'Vt.': 'Vermont', 'Va.': 'Virginia',
'Wash.': 'Washington', 'W.Va.': 'West Virginia', 'Wis.': 'Wisconsin', 'Wyo.': 'Wyoming'}
%}
{#
We have three ways of passing the source used for normalization
1. passing a dbt model using ref('') which is of type Relation.
2. passing a common table expression that contains the source mapping
Note: model or cte must include "source" and "target" column names used for normalization in 1. & 2. repectively
3. passing a dictionary of values that map from source -> target ie {[source]: [target]}
#}
select distinct * from (
select state, code, state__normalized from {{ f2dq.normalize_values(ref('abbreviated_us_states'), 'state', ref('us_states_normalization')) }} s
union all
select state, code, state__normalized from {{ f2dq.normalize_values(ref('abbreviated_us_states'), 'state', 'us_states_normalization_cte') }} s
union all
select state, code, state__normalized from {{ f2dq.normalize_values(ref('abbreviated_us_states'), 'state', us_states_mapping) }} s
) as normalized
@@ -0,0 +1,27 @@
version: 2
models:
- name: validated_emails
tests:
- dbt_utils.equality:
compare_model: ref('expected_validated_emails')
- name: validated_numbers
tests:
- dbt_utils.equality:
compare_model: ref('expected_validated_numbers')
- name: validated_date_and_time
tests:
- dbt_utils.equality:
compare_model: ref('expected_validated_date_and_time')
- name: validated_ips
tests:
- dbt_utils.equality:
compare_model: ref('expected_validated_ips')
- name: validated_uuids
tests:
- dbt_utils.equality:
compare_model: ref('expected_validated_uuids')
@@ -0,0 +1,14 @@
with
all_rows as (
select * from {{ ref('validate_date_and_time') }}
)
select *,
case when {{ f2dq.valid_date_eu('date_time') }} then 1 else 0 end as valid_date_eu,
case when {{ f2dq.valid_date_us('date_time') }} then 1 else 0 end as valid_date_us,
case when {{ f2dq.valid_date_inverse('date_time') }} then 1 else 0 end as valid_date_inverse,
case when {{ f2dq.valid_date_iso_8601('date_time') }} then 1 else 0 end as valid_date_iso_8601,
case when {{ f2dq.valid_time_24h('date_time') }} then 1 else 0 end as valid_time_24h,
case when {{ f2dq.valid_time_12h('date_time') }} then 1 else 0 end as valid_time_12h,
case when {{ f2dq.valid_time('date_time') }} then 1 else 0 end as valid_time
from all_rows
@@ -0,0 +1,7 @@
with
all_emails as (
select * from {{ ref('validate_emails') }}
)
select *, case when {{ f2dq.valid_email('email') }} then 1 else 0 end as email_valid
from all_emails
@@ -0,0 +1,10 @@
with
all_rows as (
select * from {{ ref('validate_ip') }}
)
select *,
case when {{ f2dq.valid_ip_v4('ip_address') }} then 1 else 0 end as valid_ip_v4,
case when {{ f2dq.valid_ip_v6('ip_address') }} then 1 else 0 end as valid_ip_v6,
case when {{ f2dq.valid_ip('ip_address') }} then 1 else 0 end as valid_ip
from all_rows
@@ -0,0 +1,13 @@
with
all_num_rows as (
select * from {{ ref('validate_numbers') }}
)
select *,
case when {{ f2dq.valid_number('number') }} then 1 else 0 end as is_number,
case when {{ f2dq.valid_number_decimal_point('number') }} then 1 else 0 end as is_number_decimal_point,
case when {{ f2dq.valid_number_decimal_comma('number') }} then 1 else 0 end as is_number_decimal_comma,
case when {{ f2dq.valid_number_percentage('number') }} then 1 else 0 end as is_percentage,
case when {{ f2dq.valid_number_percentage_point('number') }} then 1 else 0 end as is_percentage_decimal_point,
case when {{ f2dq.valid_number_percentage_comma('number') }} then 1 else 0 end as is_percentage_decimal_comma
from all_num_rows
@@ -0,0 +1,8 @@
with
all_rows as (
select * from {{ ref('validate_uuid') }}
)
select *,
case when {{ f2dq.valid_uuid('uuid') }} then 1 else 0 end as valid_uuid
from all_rows