Skip to content

Commit

Permalink
Merge branch 'dbt-labs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-vl authored Dec 8, 2023
2 parents e523ef6 + 9a4d4da commit 4d10e80
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ workflows:
context: profile-snowflake
- integration-bigquery:
context: profile-bigquery
- integration-databricks:
context:
- aws-credentials
- profile-databricks
# - integration-databricks:
# context:
# - aws-credentials
# - profile-databricks
#- integration-synapse:
# context: profile-synapse
#- integration-azuresql:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# **what?**
# For issues that have been open for awhile without activity, label
# them as stale with a warning that they will be closed out. If
# anyone comments to keep the issue open, it will automatically
# remove the stale label and keep it open.

# Stale label rules:
# awaiting_response, more_information_needed -> 90 days
# good_first_issue, help_wanted -> 360 days (a year)
# tech_debt -> 720 (2 years)
# all else defaults -> 180 days (6 months)

# **why?**
# To keep the repo in a clean state from issues that aren't relevant anymore

# **when?**
# Once a day

name: "Close stale issues and PRs"
on:
schedule:
- cron: "30 1 * * *"

permissions:
issues: write
pull-requests: write

jobs:
stale:
uses: dbt-labs/actions/.github/workflows/stale-bot-matrix.yml@main
31 changes: 31 additions & 0 deletions .github/workflows/triage-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# **what?**
# When the maintenance team triages, we sometimes need more information from the issue creator. In
# those cases we remove the `triage` label and add the `awaiting_response` label. Once we
# recieve a response in the form of a comment, we want the `awaiting_response` label removed
# in favor of the `triage` label so we are aware that the issue needs action.

# **why?**
# To help with out team triage issue tracking

# **when?**
# This will run when a comment is added to an issue and that issue has the `awaiting_response` label.

name: Update Triage Label

on: issue_comment

defaults:
run:
shell: bash

permissions:
issues: write

jobs:
triage_label:
if: contains(github.event.issue.labels.*.name, 'awaiting_response')
uses: dbt-labs/actions/.github/workflows/swap-labels.yml@main
with:
add_label: "triage"
remove_label: "awaiting_response"
secrets: inherit
22 changes: 22 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# dbt-external-tables releases

## When do we release?
There's a few scenarios that might prompt a release:

| Scenario | Release type |
|--------------------------------------------|--------------|
| Breaking changes to existing macros | minor |
| New functionality | minor |
| Fixes to existing macros | patch |

## Release process

1. Begin a new release by clicking [here](https://github.com/dbt-labs/dbt-external-tables/releases/new)
1. Click "Choose a tag", then paste your version number (with no "v" in the name), then click "Create new tag: x.y.z. on publish"
- The “Release title” will be identical to the tag name
1. Click the "Generate release notes" button
1. Copy and paste the generated release notes into `CHANGELOG.md`, commit, and merge into the `main` branch
1. Click the "Publish release" button
- This will automatically create an "Assets" section containing:
- Source code (zip)
- Source code (tar.gz)
7 changes: 7 additions & 0 deletions macros/plugins/bigquery/create_external_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{%- set external = source_node.external -%}
{%- set partitions = external.partitions -%}
{%- set options = external.options -%}

{% if options is mapping and options.get('connection_name', none) %}
{% set connection_name = options.pop('connection_name') %}
{% endif %}

{%- set uris = [] -%}
{%- if options is mapping and options.get('uris', none) -%}
Expand All @@ -27,6 +31,9 @@
{%- endfor -%}
) {% endif -%}
{% endif %}
{% if connection_name %}
with connection `{{ connection_name }}`
{% endif %}
options (
uris = [{%- for uri in uris -%} '{{uri}}' {{- "," if not loop.last}} {%- endfor -%}]
{%- if options is mapping -%}
Expand Down
32 changes: 32 additions & 0 deletions macros/plugins/snowflake/create_external_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% macro snowflake__create_external_schema(source_node) %}

{% set schema_exists_query %}
show terse schemas like '{{ source_node.schema }}' in database {{ source_node.database }} limit 1;
{% endset %}
{% if execute %}
{% set schema_exists = run_query(schema_exists_query)|length > 0 %}
{% else %}
{% set schema_exists = false %}
{% endif %}

{% if schema_exists %}
{% set ddl %}
select 'Schema {{ source_node.schema }} exists' from dual;
{% endset %}
{% else %}
{% set fqn %}
{% if source_node.database %}
{{ source_node.database }}.{{ source_node.schema }}
{% else %}
{{ source_node.schema }}
{% endif %}
{% endset %}

{% set ddl %}
create schema if not exists {{ fqn }};
{% endset %}
{% endif %}

{% do return(ddl) %}

{% endmacro %}

0 comments on commit 4d10e80

Please sign in to comment.