-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into br_ibge_criacao_municipio
- Loading branch information
Showing
456 changed files
with
104,122 additions
and
7,264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: Check BQ project name | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: ['**/*.sql'] | ||
jobs: | ||
check_bucket_name: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Get changed files | ||
id: get_files | ||
uses: dorny/paths-filter@v2 | ||
with: | ||
list-files: shell | ||
filters: | | ||
pr: | ||
- added|deleted|modified: '**' | ||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- name: Run Python script | ||
run: |- | ||
for file in ${{ steps.get_files.outputs.pr_files }}; do | ||
if [[ $file == *.sql ]]; then | ||
echo "SQL file detected: $file" | ||
python .github/workflows/scripts/check_sql_files.py $file | ||
else | ||
echo "Não é um arquivo SQL: $file" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Deploy Elementary Report | ||
on: | ||
push: | ||
branches: [main, master] | ||
schedule: | ||
- cron: 00 22 * * 1-5 | ||
workflow_dispatch: | ||
jobs: | ||
elementary: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout dbt project | ||
uses: actions/checkout@v3 | ||
- name: Run Elementary | ||
uses: elementary-data/run-elementary-action@v1.12 | ||
with: | ||
warehouse-type: bigquery | ||
adapter-version: 1.5.9 | ||
profiles-yml: ${{ secrets.ELEMENTARY_PROFILES_YML }} | ||
edr-command: edr report --file-path "report.html" --days-back 90 && edr | ||
send-report --google-service-account-path "/tmp/gcs_keyfile.json" --gcs-bucket-name | ||
"basedosdados" --update-bucket-website "true" --days-back 90 | ||
bigquery-keyfile: ${{ secrets.BIGQUERY_KEYFILE }} | ||
gcs-keyfile: ${{ secrets.GCS_KEYFILE }} | ||
- name: Upload report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: report.html | ||
path: report.html | ||
- name: Upload log | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: edr.log | ||
path: edr.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import argparse | ||
import os | ||
|
||
def check_sql_files(file): | ||
found_staging = False | ||
if os.path.exists(file) and file.endswith(".sql"): | ||
with open(file, "r") as f: | ||
lines = f.readlines() | ||
for line in lines: | ||
if "basedosdados-dev" in line: | ||
found_staging = True | ||
print(f"Found 'basedosdados-dev' in {file}") | ||
break | ||
return found_staging | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Check for 'basedosdados-dev' occurrences in SQL files.") | ||
parser.add_argument("file", help="Path to the SQL file to check") | ||
args = parser.parse_args() | ||
|
||
if check_sql_files(args.file): | ||
exit(1) | ||
else: | ||
print("No occurrences of 'basedosdados-staging' found in SQL files.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.