Skip to content

Commit 59f8ac7

Browse files
author
Adriano Sanges
committed
Refactor environment variable loading in scan_properties.py and telegram_api.py
- Consolidate environment variable loading by directly invoking load_dotenv() without multiple file path checks - Enhance code clarity and maintainability by eliminating redundant functions
1 parent f0415b1 commit 59f8ac7

File tree

15 files changed

+1013
-0
lines changed

15 files changed

+1013
-0
lines changed

real_estate_dbt/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
target/
3+
dbt_packages/
4+
logs/

real_estate_dbt/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

real_estate_dbt/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Welcome to your new dbt project!
2+
3+
### Using the starter project
4+
5+
Try running the following commands:
6+
- dbt run
7+
- dbt test
8+
9+
10+
### Resources:
11+
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
12+
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
13+
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
14+
- Find [dbt events](https://events.getdbt.com) near you
15+
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices

real_estate_dbt/analyses/.gitkeep

Whitespace-only changes.

real_estate_dbt/config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
gateways:
2+
local:
3+
connection:
4+
type: motherduck
5+
database: adriano_warehouse
6+
token: {{ env_var('motherduck_token') }}
7+
8+
default_gateway: local
9+
10+
model_defaults:
11+
dialect: duckdb
12+
start: 2025-02-20

real_estate_dbt/dbt_project.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Name your project! Project names should contain only lowercase characters
2+
# and underscores. A good package name should reflect your organization's
3+
# name or the intended use of these models
4+
name: "real_estate_dbt"
5+
version: "1.0.0"
6+
config-version: 2
7+
8+
# This setting configures which "profile" dbt uses for this project.
9+
profile: "real_estate_dbt"
10+
11+
# These configurations specify where dbt should look for different types of files.
12+
# The `model-paths` config, for example, states that models in this project can be
13+
# found in the "models/" directory. You probably won't need to change these!
14+
model-paths: ["models"]
15+
analysis-paths: ["analyses"]
16+
test-paths: ["tests"]
17+
seed-paths: ["seeds"]
18+
macro-paths: ["macros"]
19+
snapshot-paths: ["snapshots"]
20+
21+
target-path: "target" # directory which will store compiled SQL files
22+
clean-targets: # directories to be removed by `dbt clean`
23+
- "target"
24+
- "dbt_packages"
25+
26+
# Configuring models
27+
# Full documentation: https://docs.getdbt.com/docs/configuring-models
28+
29+
# In this example config, we tell dbt to build all models in the example/ directory
30+
# as tables. These settings can be overridden in the individual model files
31+
# using the `{{ config(...) }}` macro.
32+
models:
33+
real_estate_dbt:
34+
# Config indicated by + and applies to all files under models/example/
35+
example:
36+
+materialized: table

real_estate_dbt/macros/.gitkeep

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ config(
2+
materialized='incremental',
3+
unique_key='url'
4+
) }}
5+
6+
SELECT
7+
*
8+
FROM
9+
{{ ref('properties') }}
10+
WHERE
11+
{% if is_incremental() %}
12+
created_at BETWEEN '{{ this.start_date }}' AND '{{ this.end_date }}'
13+
{% else %}
14+
created_at >= '2020-01-01'
15+
{% endif %}
16+
AND price < 10000000
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
3+
models:
4+
- name: cleaned_properties
5+
description: "A cleaned properties table with incremental updates"
6+
columns:
7+
- name: url
8+
description: "The unique URL for the property"
9+
tests:
10+
- unique
11+
- not_null
12+
- name: created_at
13+
description: "The timestamp when the property was created"
14+
- name: price
15+
description: "The price of the property"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
real_estate_dbt:
2+
target: dev
3+
outputs:
4+
dev:
5+
type: motherduck
6+
database: adriano_warehouse
7+
token: "{{ env_var('motherduck_token') }}"

0 commit comments

Comments
 (0)