Skip to content

Commit

Permalink
Merge pull request #940 from openedx/cag/sql-format-2
Browse files Browse the repository at this point in the history
fix(dev): sql parse dataset SQL statement
  • Loading branch information
Cristhian Garcia authored Sep 12, 2024
2 parents 68b75dd + 6409f39 commit eb3f6bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ jobs:
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.12
- name: Install aspects
run: pip install .
run: |
pip install -r requirements/dev.txt
pip install -e .
- name: Save config
run: tutor config save
- name: Setup Docker Buildx
Expand Down
6 changes: 6 additions & 0 deletions tutoraspects/asset_command_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import re
import json
from zipfile import ZipFile
from sqlfmt.api import format_string
from sqlfmt.mode import Mode

import click
import yaml
Expand Down Expand Up @@ -212,6 +214,10 @@ def process(self, content: dict, existing: dict):
if not metric.get("verbose_name"):
metric["verbose_name"] = metric["metric_name"].replace("_", " ").title()

content["sql"] = format_string(
content["sql"], mode=Mode(dialect_name="clickhouse")
)


class DatabaseAsset(Asset):
"""
Expand Down

0 comments on commit eb3f6bd

Please sign in to comment.