<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vitalii Polyvianyi on Medium]]></title>
        <description><![CDATA[Stories by Vitalii Polyvianyi on Medium]]></description>
        <link>https://medium.com/@vitalii.polyvianyi?source=rss-3ca3f9d3da84------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FWBlddegkK7A9U_BObTcvg.jpeg</url>
            <title>Stories by Vitalii Polyvianyi on Medium</title>
            <link>https://medium.com/@vitalii.polyvianyi?source=rss-3ca3f9d3da84------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:13:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vitalii.polyvianyi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Routing alerts in Slack/PagerDuty by severity — so noise doesn’t kill you]]></title>
            <link>https://medium.com/dataops-tech/routing-alerts-in-slack-pagerduty-by-severity-so-noise-doesnt-kill-you-874060ef2996?source=rss-3ca3f9d3da84------2</link>
            <guid isPermaLink="false">https://medium.com/p/874060ef2996</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[alerting]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[noise]]></category>
            <dc:creator><![CDATA[Vitalii Polyvianyi]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 10:59:10 GMT</pubDate>
            <atom:updated>2025-09-04T10:59:10.915Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Routing alerts in Slack/PagerDuty by severity, so noise doesn’t kill you</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SL0lRnzPv9CJqPifbnJ3pg.png" /></figure><p><strong>Goal:</strong> make sure the <strong>important stuff</strong> always reaches the right people (and triggers PagerDuty), while <strong>noise</strong> goes to quiet Slack channels and doesn’t get in the way.</p><p>1. Give alerts a <strong>clear severity model</strong> (P1–P4 / critical–warning–info).</p><p>2. Add <strong>labels</strong>: env, team, service, component, severity, runbook, dashboard</p><p>3. In Alertmanager/VMAlert, configure a <strong>routing tree</strong>:</p><ul><li>severity=critical AND env=prod → PagerDuty + the team’s Slack channel</li><li>severity=warning → Slack only (with strict grouping/repeat intervals)</li><li>env!=prod → quiet channels, no night-time notifications</li></ul><p>4. Add <strong>inhibit rules</strong> (critical suppresses warnings) and <strong>time windows</strong> (at night — only P1).</p><p>5. For SLOs — use <strong>burn rate</strong>; for jobs — set concrete thresholds for <strong>freshness/volume/errors</strong>.</p><h3>Severity model (example for Data/ETL)</h3><p><strong>Rule:</strong> it’s better to have <strong>2–3 crisp thresholds per signal</strong> than <em>one fuzzy alert that covers everything</em>.</p><h3>Signal taxonomy</h3><ul><li><strong>Freshness:</strong> “data hasn’t been updated for N minutes.”</li><li><strong>Completeness:</strong> “new record volume dropped by X% vs baseline.”</li><li><strong>Correctness:</strong> “sharp divergence in counts, dashboard drift.”</li><li><strong>Pipeline health:</strong> “DAG starvation / lost workers / retry storms.”</li><li><strong>Infra:</strong> S3/ATHENA/secrets/quotas.</li></ul><h3>Label contract (mandatory)</h3><p>Every alert rule adds:</p><ul><li>severity: critical|error|warning|info</li><li>env: prod|stage|dev</li><li>team: e.g., data-platform</li><li>service/component: airflow, dbt, ltv, adyen, etc.</li><li>runbook: URL with “what to do”</li><li>dashboard: link to the chart/panel</li></ul><p>This makes routing and on-call support predictable.</p><h3>Example rules (VMAlert/Prometheus-compatible)</h3><h3>Mart freshness (warning/critical)</h3><pre>groups:<br>- name: freshness.rules<br>  rules:<br>  - alert: DataFreshnessHigh<br>    expr: (time() - data_last_success_unixtime{dataset=&quot;ltv_transactions&quot;, env=&quot;prod&quot;}) &gt; 15*60<br>    for: 5m<br>    labels:<br>      severity: warning<br>      env: prod<br>      team: data-platform<br>      service: ltv<br>      runbook: https://runbooks.company/ltv-freshness<br>      dashboard: https://grafana.company/d/ltv<br>    annotations:<br>      summary: &quot;LTV freshness &gt; 15 minutes&quot;<br>      description: &quot;Last success was {{ $value | humanizeDuration }} ago&quot;<br><br>  - alert: DataFreshnessCritical<br>    expr: (time() - data_last_success_unixtime{dataset=&quot;ltv_transactions&quot;, env=&quot;prod&quot;}) &gt; 60*60<br>    for: 5m<br>    labels:<br>      severity: critical<br>      env: prod<br>      team: data-platform<br>      service: ltv<br>      runbook: https://runbooks.company/ltv-freshness<br>      dashboard: https://grafana.company/d/ltv<br>    annotations:<br>      summary: &quot;CRIT: LTV freshness &gt; 60 minutes&quot;<br>      description: &quot;Staleness duration: {{ $value | humanizeDuration }}&quot;</pre><h3>Airflow: failure spike</h3><pre>- name: airflow.rules<br>  rules:<br>  - alert: AirflowFailuresSpike<br>    expr: increase(airflow_task_failed_total{env=&quot;prod&quot;}[5m]) &gt; 20<br>    for: 10m<br>    labels:<br>      severity: critical<br>      env: prod<br>      team: data-platform<br>      service: airflow<br>      runbook: https://runbooks.company/airflow-failures<br>      dashboard: https://grafana.company/d/airflow<br>    annotations:<br>      summary: &quot;CRIT: Airflow task failure wave&quot;<br>      description: &quot;Over 20 tasks failed in 5m. Check workers/broker/secrets.&quot;</pre><h3>Volume drift (bronze → silver)</h3><pre>- name: volume.rules<br>  rules:<br>  - alert: VolumeDriftWarning<br>    expr: |<br>      abs( (sum(rate(bronze_ingest_rows_total{table=&quot;adyen&quot;}[30m])) <br>          - sum(rate(silver_rows_total{table=&quot;adyen&quot;}[30m])))<br>          / clamp_min(sum(rate(bronze_ingest_rows_total{table=&quot;adyen&quot;}[30m])), 1) ) &gt; 0.2<br>    for: 20m<br>    labels:<br>      severity: warning<br>      env: prod<br>      team: data-platform<br>      service: adyen<br>      runbook: https://runbooks.company/adyen-volume<br>      dashboard: https://grafana.company/d/adyen<br>    annotations:<br>      summary: &quot;Adyen volume drift &gt; 20%&quot;<br>      description: &quot;Check dedup/incremental boundaries.&quot;</pre><h3>SLO burn rate (two windowed estimates)</h3><pre>- name: slo.rules<br>  rules:<br>  - alert: LTVSLOBurnFast<br>    expr: (1 - slo_ok_ratio{service=&quot;ltv&quot;, env=&quot;prod&quot;}[5m]) / (1 - 0.99) &gt; 5<br>    for: 10m<br>    labels: {severity: critical, env: prod, team: data-platform, service: ltv}<br>    annotations:<br>      summary: &quot;CRIT: Fast SLO burn for LTV&quot;<br>      description: &quot;5m window burning error budget &gt;5×.&quot;<br><br>  - alert: LTVSLOBurnSlow<br>    expr: (1 - slo_ok_ratio{service=&quot;ltv&quot;, env=&quot;prod&quot;}[1h]) / (1 - 0.99) &gt; 1<br>    for: 30m<br>    labels: {severity: error, env: prod, team: data-platform, service: ltv}<br>    annotations:<br>      summary: &quot;Sustained SLO burn for LTV&quot;<br>      description: &quot;1h window shows ongoing burn.&quot;</pre><h3>Routing in Alertmanager: the routing tree</h3><p><strong>Idea</strong></p><ul><li>The root route groups and sets timings.</li><li>Branches by severity/env/team.</li><li><strong>critical + prod</strong> → PagerDuty <strong>and</strong> the team’s Slack; continue: true for fan-out.</li><li><strong>warning</strong> → Slack only (with strict grouping).</li><li>Night-time windows: mute everything except critical.</li></ul><p><strong>Example config</strong></p><pre>route:<br>  group_by: [&#39;alertname&#39;,&#39;service&#39;,&#39;env&#39;,&#39;team&#39;]<br>  group_wait: 30s<br>  group_interval: 5m<br>  repeat_interval: 2h<br>  receiver: slack-default<br><br>  routes:<br>  - matchers:<br>      - &#39;env=&quot;prod&quot;&#39;<br>      - &#39;severity=&quot;critical&quot;&#39;<br>    receiver: pagerduty-prod<br>    continue: true<br>    routes:<br>    - matchers: [&#39;team=&quot;data-platform&quot;&#39;]<br>      receiver: slack-data-platform<br><br>  - matchers:<br>      - &#39;severity=&quot;error&quot;&#39;<br>      - &#39;env=&quot;prod&quot;&#39;<br>    receiver: slack-prod<br>    repeat_interval: 1h<br><br>  - matchers:<br>      - &#39;severity=&quot;warning&quot;&#39;<br>    receiver: slack-warning<br>    active_time_intervals: [&#39;work-hours&#39;]<br>    repeat_interval: 4h<br><br>  - matchers:<br>      - &#39;env!=&quot;prod&quot;&#39;<br>    receiver: slack-dev<br>    active_time_intervals: [&#39;work-hours&#39;]<br>    group_wait: 1m<br>    repeat_interval: 6h<br><br>receivers:<br>- name: slack-default<br>  slack_configs:<br>  - send_resolved: true<br>    api_url: ${SLACK_WEBHOOK_DEFAULT}<br>    channel: &#39;#alerts&#39;<br>    title: &#39;[{{ .Status | toUpper }}] {{ .CommonLabels.alertname }} ({{ .CommonLabels.env }})&#39;<br>    text: &gt;<br>      *Severity:* {{ .CommonLabels.severity }}<br>      *Service:* {{ .CommonLabels.service }}<br>      *Team:* {{ .CommonLabels.team }}<br>      *Runbook:* {{ .CommonAnnotations.runbook }}<br>      *Dashboard:* {{ .CommonAnnotations.dashboard }}<br><br>- name: slack-data-platform<br>  slack_configs:<br>  - send_resolved: true<br>    api_url: ${SLACK_WEBHOOK_DATA_PLATFORM}<br>    channel: &#39;#data-platform-alerts&#39;<br><br>- name: slack-prod<br>  slack_configs:<br>  - api_url: ${SLACK_WEBHOOK_PROD}<br>    channel: &#39;#prod-alerts&#39;<br><br>- name: slack-warning<br>  slack_configs:<br>  - api_url: ${SLACK_WEBHOOK_WARNING}<br>    channel: &#39;#warnings&#39;<br><br>- name: slack-dev<br>  slack_configs:<br>  - api_url: ${SLACK_WEBHOOK_DEV}<br>    channel: &#39;#dev-alerts&#39;<br><br>- name: pagerduty-prod<br>  pagerduty_configs:<br>  - routing_key: ${PAGERDUTY_ROUTING_KEY_PROD}<br>    severity: &#39;{{ .CommonLabels.severity | default &quot;critical&quot; }}&#39;   # PD supports info|warning|error|critical<br>    send_resolved: true<br><br># Inhibit: a critical alert suppresses warnings/errors of the same alert<br>inhibit_rules:<br>- source_matchers: [&#39;severity=&quot;critical&quot;&#39;]<br>  target_matchers: [&#39;severity=~&quot;warning|error&quot;&#39;]<br>  equal: [&#39;alertname&#39;,&#39;service&#39;,&#39;env&#39;,&#39;team&#39;]<br><br># Time windows (Europe/Kyiv)<br>time_intervals:<br>- name: work-hours<br>  time_intervals:<br>  - weekdays: [&#39;monday:friday&#39;]<br>    times:<br>    - start_time: &#39;09:00&#39;<br>      end_time: &#39;19:00&#39;<br>    location: &#39;Europe/Kyiv&#39;</pre><p><strong>Notes:</strong></p><ul><li>Use continue: true so one event fans out to both PD and the right Slack channel.</li><li>Pick repeat_interval <strong>longer than typical fix time</strong> to avoid duplicate noise.</li><li>Keep secrets (api_url, routing_key) in env or an external secret store.</li></ul><h3>Escalation and quiet hours</h3><ul><li>For <strong>warning/error</strong> — <strong>business hours</strong> only.</li><li>For <strong>critical</strong> — <strong>24/7</strong>.</li><li><strong>Auto-escalation:</strong> if a warning isn’t resolved within 30 minutes, resend as error. Implement via a separate rule or a PD policy.</li><li><strong>Inhibit:</strong> when a critical alert is firing, “lower-severity” alerts of the same kind don’t spam.</li></ul><h3>Grouping and deduplication</h3><ul><li>group_by: [&#39;alertname&#39;,&#39;service&#39;,&#39;env&#39;,&#39;team&#39;] — minimal necessary keys.</li><li>group_wait: 30s — wait to batch similar alerts.</li><li>group_interval: 5m — don’t resend every 10 seconds.</li><li>For “chatty” sources (task retries) — increase for: in rules.</li></ul><h3>Silences and maintenance</h3><ul><li><strong>Planned window:</strong> create a Silence with matchers env=&quot;prod&quot;, team=&quot;data-platform&quot;, service=&quot;airflow&quot;, duration 30–60 min.</li><li><strong>CI hook:</strong> during deploy — auto-silence the relevant services (via Alertmanager API) so migrations don’t wake the team.</li></ul><h3>Per-alert checklist</h3><ul><li>Has severity/env/team/service</li><li>Has runbook and dashboard</li><li>Threshold justified (data/history)</li><li>Has for: (stability)</li><li>Alert tested (rule test / promtool)</li><li>Ownership clear (team) and routing destination defined</li></ul><h3>Step-by-step rollout (painless)</h3><ol><li>Align on the P1–P4 model and examples.</li><li>Enforce a unified <strong>label contract</strong> in rules.</li><li>Enable <strong>inhibit rules</strong> and <strong>night-time windows</strong>.</li><li>Split Slack channels (prod, warnings, dev).</li><li>Add PagerDuty <strong>only for P1 prod</strong>.</li><li>Re-check thresholds against historical charts.</li><li>Write runbooks (at least 5–10 key incidents).</li><li>Enable burn-rate alerts for the most critical SLOs.</li><li>Add deploy-time auto-silences.</li><li>Run a monthly <strong>post-review of noisy alerts</strong> (trim/tune).</li></ol><h3><strong>Summary</strong></h3><p>Good routing = <strong>label contract + routing tree + sane thresholds</strong>.</p><p>Critical =&gt; PagerDuty + the right Slack channel;</p><p>everything else =&gt; quiet and controlled.</p><p>Add inhibit, time windows, and burn rate — so as a result your team stops going “alert-blind” and focuses on real problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=874060ef2996" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataops-tech/routing-alerts-in-slack-pagerduty-by-severity-so-noise-doesnt-kill-you-874060ef2996">Routing alerts in Slack/PagerDuty by severity — so noise doesn’t kill you</a> was originally published in <a href="https://medium.com/dataops-tech">DataOps.tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to understand that it is time to refactor ETL: signals and recommendations]]></title>
            <link>https://medium.com/dataops-tech/how-to-understand-that-it-is-time-to-refactor-etl-signals-and-recommendations-5ea25d08c838?source=rss-3ca3f9d3da84------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ea25d08c838</guid>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[data-quality]]></category>
            <dc:creator><![CDATA[Vitalii Polyvianyi]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 09:47:53 GMT</pubDate>
            <atom:updated>2025-06-05T09:47:53.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n3U4W4EikhCBgRZU" /></figure><p>ETL (Extract, Transform, Load) is a critical element of any analytical or BI system. It ensures that high-quality and relevant data is delivered to the warehouse and reports. However, as the volume of data grows, logic becomes more complex, and business requirements expand, even well-built ETL processes begin to fail and require revision.</p><p>In this article, we will look at the key signs that ETL needs refactoring, and approaches that will help make the process more stable, faster and scalable.</p><p><strong>Signs that ETL needs refactoring</strong></p><ol><li><strong>ETL execution time has increased significantly</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KG4j2prxeb_3TIuf35MGdA.png" /></figure><p>If an ETL that used to run in 10–15 minutes now takes hours, that’s a red flag. With each run, you’re wasting resources, money, and analyst time waiting for updated data.</p><p><strong>Possible reasons:</strong></p><ul><li><strong>Full refresh: </strong>ETL processes the entire table every day, regardless of whether the data has changed or not. Example: loading all orders for 5 years every day, instead of processing only new/changed records.</li><li><strong>Suboptimal SQL queries: </strong>Heavy subqueries, JOIN without indexes, SELECT *, no filters or constraints. Example: query without WHERE, working on the entire table with millions of rows.</li><li><strong>Sequential processing instead of parallel: </strong>All steps are executed one after another, although they can be run in parallel by dates, regions, IDs, etc. Example: processing country data in one thread instead of running in 10 threads.</li><li><strong>Excessive I/O usage: </strong>Temporary data is written to disk (CSV, JSON, Excel) and then read again. This is especially slow for large volumes.</li><li><strong>Outdated technologies: </strong>Old versions of Pandas, Spark, Airflow are used, which work less efficiently.</li><li><strong>Lack of incremental approach: </strong>All data is loaded and transformed every time, without taking into account that most of it has not changed.</li><li><strong>Duplicate or redundant transformations: </strong>The same steps are performed in different parts of the pipeline, increasing the load and time.</li></ul><p><strong>2. Common errors and crashes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6AsuDrgiL1WLvo7BiGCN0w.jpeg" /></figure><p>If the ETL is unstable and has to be “manually repaired” on a regular basis, this is a symptom of technical debt.</p><p><strong>What could be the reason:</strong></p><ul><li><strong>Hard-coded logic: </strong>Magic numbers, column names, file paths are hard-coded.</li><li><strong>No exception handling: </strong>An error in one step crashes the entire process without the possibility of restarting from a checkpoint.</li><li><strong>Untrusted external sources: </strong>The API may not respond, the file may not load — and your pipeline can’t handle it.</li></ul><p><strong>3. Complex and unreadable code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHRd58rSChQNJeUXZUr8tQ.png" /></figure><p>If developers avoid working with ETL logic, this is a sign that it is:</p><ul><li>Monolithic and difficult to scale.</li><li>Poorly structured and not divided into modules.</li><li>Not documented.</li><li>Has duplicate or outdated logic.</li></ul><p>All this slows down development, increases the risk of errors and makes the project vulnerable to team changes.</p><p><strong>4. New requirements are difficult to implement</strong></p><p>If each new field in a report or data source requires reworking the entire logic:</p><ul><li>ETL architecture does not support extension.</li><li>No separation of extraction, transformation and loading logic.</li><li>All steps are tightly coupled.</li></ul><p><strong>5. Lack of testing and monitoring</strong></p><p>Without tests and metrics, ETL works blindly. Problems are discovered in reports or when users complain.</p><p><strong>What is needed:</strong></p><ul><li><strong>Data integrity tests:</strong> schemas, required fields, types.</li><li><strong>Business validation: </strong>for example, the number of transactions must be &gt; 0.</li><li><strong>Performance monitoring:</strong> tracking execution time, data volume, errors.</li></ul><p><strong>When and how to refactor</strong></p><p>Refactoring does not always mean “rewriting everything from scratch.” It is a process of iterative improvement that can (and should) occur in parallel with the evolution of the system.</p><p><strong>Conduct a technical audit every 6–12 months</strong></p><p>Analyze: where ETL has become slower, where failures often occur, which parts of the code are no longer relevant.</p><p><strong>Implement metrics and logs</strong></p><p>Collect:</p><ul><li>The time it takes to complete each step.</li><li>The number of records processed.</li><li>The frequency of errors and reasons for manual intervention.</li></ul><p><strong>Move to a modular architecture</strong></p><p>Each step (extract, transform, load) should be independent and reusable. This makes testing, scaling and maintenance easier.</p><p><strong>Add automated testing</strong></p><p>Cover ETL with unit tests, data checks, schema checks, and business logic level validation.</p><p><strong>Use incremental loading</strong></p><p>Load and process only the data that has changed. This speeds up the process and reduces the load on sources and storage.</p><p><strong>Refactoring is a means, not an end</strong></p><p>Refactoring is not done for the sake of “beautiful code”. It is needed to:</p><ul><li>Speed ​​up data delivery.</li><li>Increase ETL reliability.</li><li>Make the system adaptable to changes.</li></ul><p><strong>Refactoring should be started when:</strong></p><ul><li>The team spends more time fixing bugs than developing.</li><li>The architecture cannot cope with the growth of data.</li><li>The business requires greater flexibility and speed in analytics.</li></ul><p><strong>Conclusion</strong></p><p>ETL is not a one-time setup, but an ongoing process. It should evolve with the product and business. Refactoring started in time:</p><ul><li>Reduces risks,</li><li>Improves data quality,</li><li>Makes the analytical infrastructure more resilient.</li></ul><p>Monitor symptoms, evaluate performance regularly, and don’t be afraid to improve. It’s an investment in the stability of your analytics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ea25d08c838" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataops-tech/how-to-understand-that-it-is-time-to-refactor-etl-signals-and-recommendations-5ea25d08c838">How to understand that it is time to refactor ETL: signals and recommendations</a> was originally published in <a href="https://medium.com/dataops-tech">DataOps.tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dlt system tables]]></title>
            <link>https://medium.com/dataops-tech/dlt-system-tables-c87900e5b00a?source=rss-3ca3f9d3da84------2</link>
            <guid isPermaLink="false">https://medium.com/p/c87900e5b00a</guid>
            <category><![CDATA[data-management]]></category>
            <category><![CDATA[dlt]]></category>
            <category><![CDATA[system-tables]]></category>
            <category><![CDATA[data-platforms]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Vitalii Polyvianyi]]></dc:creator>
            <pubDate>Fri, 04 Apr 2025 15:59:20 GMT</pubDate>
            <atom:updated>2025-04-04T15:59:20.426Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RGDAUw82U3HGLFVKYb0PNA.gif" /><figcaption><a href="https://dlthub.com/">dlthub.com</a></figcaption></figure><p>dlt (data load tools) is a powerful data processing tool that uses system tables to store essential system information. These tables help track the dltversion, monitor the current state of the data pipeline, and keep a history of data loads.</p><h4><strong>_dlt_version table</strong></h4><p>The _dlt_version table contains information about the dlt version used for database table creation and management. This can be useful for troubleshooting errors or tracking dlt updates.</p><p>How to check the current dlt version:</p><pre>SELECT * FROM _dlt_version;</pre><p>Typical columns in this table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGP4K7nhDbbogGYVwIWt8w.png" /></figure><p>If errors occur or an update is performed, checking this table can help determine which dlt version was used.</p><p><strong>_dlt_pipeline_state table</strong></p><p>This table stores the current state of the data pipeline, helping to:</p><ul><li>Track pipeline execution</li><li>Resume operations after failures</li><li>Manage incremental data loading</li></ul><p>Depending on the configuration, this table may include the following fields:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sppHU17ehhhPzW-axR5mpg.png" /></figure><p><strong>Decoding the encrypted state column</strong></p><p>Since the state column may contain encrypted data, use the following python function to decode it:</p><pre>import base64<br>import zlib<br>def decode_state(encoded_str):<br>return zlib.decompress(base64.b64decode(encoded_str)).decode(&quot;utf-8&quot;, errors=&quot;ignore&quot;)</pre><p><strong>Deleting pipeline state</strong></p><p>To manually clear the pipeline state, run:</p><pre>DELETE FROM _dlt_pipeline_state WHERE pipeline_name = &#39;stripe_source_account&#39;;</pre><p>However, it is recommended to use pipeline.drop() in Python for safe deletion.</p><p><strong>Managing state in dlt</strong></p><p>dlt allows saving and managing state variables, which is useful for incremental data loading.</p><p><strong>Retrieving the current state</strong></p><pre>state = dlt.current.state()</pre><p><strong>Setting a value in state using setdefault()</strong></p><pre>current_start_date: pendulum.DateTime = ensure_pendulum_datetime(<br>  dlt.current.state().setdefault(<br>    f&quot;date_start_{account_id}&quot; if not manual else str(uuid.uuid4()),<br>    start_date.isoformat()<br>  )<br>)</pre><p><strong>Explanation:</strong></p><ul><li>If the key date_start_{account_id} exists, the old value is used.</li><li>If the key does not exist, start_date.isoformat() is set as the initial value.</li><li>If manual=True, a random key is created using uuid.uuid4() (creating a new state).</li><li>ensure_pendulum_datetime() converts the saved string to a pendulum.DateTime object.</li></ul><p><strong>Updating the state</strong></p><pre>dlt.current.state()[f&quot;date_start_{account_id}&quot;] = end_date</pre><p><strong>_dlt_loads table</strong></p><p>The _dlt_loads table tracks data loads into the storage system. It records both successful and failed loads, aiding in monitoring and debugging.</p><p><strong>Example structure of _dlt_loads</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxyIdwc7CVhz4ABrmYzvlg.png" /></figure><p>If a schema-related error occurs, such as :</p><pre>dlt.destinations.exceptions.DatabaseUndefinedRelation: (TABLE/COLUMN)_NOT_FOUND</pre><p>you may need to delete the saved schema in _dlt_loads. However, be careful, as this will also remove the saved state reference in _dlt_pipeline_state.</p><p><strong>Conclusion</strong></p><p>dlt system tables provide powerful tools for monitoring and managing data pipelines. They help track versions, manage load states, and restore processes in case of failures. Using these tables ensures data processing stability and transparency.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c87900e5b00a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataops-tech/dlt-system-tables-c87900e5b00a">dlt system tables</a> was originally published in <a href="https://medium.com/dataops-tech">DataOps.tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>