Skip to content

Commit

Permalink
fix(cli): fix example data contract yaml + update airflow codecov (da…
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Jan 26, 2024
1 parent 388b3ec commit 5adb799
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/airflow-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .
fail_ci_if_error: false
flags: airflow-${{ matrix.python-version }}-${{ matrix.extraPythonRequirement }}
name: pytest-airflow
flags: airflow,airflow-${{ matrix.extra_pip_extras }}
name: pytest-airflow-${{ matrix.python-version }}-${{ matrix.extra_pip_requirements }}
verbose: true

event-file:
Expand Down
2 changes: 1 addition & 1 deletion metadata-ingestion-modules/airflow-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ task testQuick(type: Exec, dependsOn: installDevTest) {
inputs.files(project.fileTree(dir: "src/", include: "**/*.py"))
inputs.files(project.fileTree(dir: "tests/"))
commandLine 'bash', '-x', '-c',
"source ${venv_name}/bin/activate && pytest -vv --continue-on-collection-errors --junit-xml=junit.quick.xml"
"source ${venv_name}/bin/activate && pytest --cov-config=setup.cfg --cov-report xml:coverage_quick.xml -vv --continue-on-collection-errors --junit-xml=junit.quick.xml"
}


Expand Down
11 changes: 11 additions & 0 deletions metadata-ingestion-modules/airflow-plugin/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import pathlib
import site


def pytest_addoption(parser):
parser.addoption(
"--update-golden-files",
action="store_true",
default=False,
)


# See https://coverage.readthedocs.io/en/latest/subprocess.html#configuring-python-for-sub-process-measurement
coverage_startup_code = "import coverage; coverage.process_startup()"
site_packages_dir = pathlib.Path(site.getsitepackages()[0])
pth_file_path = site_packages_dir / "datahub_coverage_startup.pth"
pth_file_path.write_text(coverage_startup_code)
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
# id: pet_details_dc # Optional: This is the unique identifier for the data contract
display_name: Data Contract for SampleHiveDataset
version: 1 # datahub yaml format version

# Note: this data contract yaml format is still in development, and will likely
# change in backwards-incompatible ways in the future.

entity: urn:li:dataset:(urn:li:dataPlatform:hive,SampleHiveDataset,PROD)
freshness:
time: 0700
granularity: DAILY
type: cron
cron: 0 7 * * * # 7am daily
timezone: America/Los_Angeles
schema:
properties:
field_foo:
type: string
native_type: VARCHAR(100)
field_bar:
type: boolean
required:
- field_bar
type: json-schema
json-schema:
properties:
field_foo:
type: string
native_type: VARCHAR(100)
field_bar:
type: boolean
required:
- field_bar
data_quality:
- type: column_range
config:
column: field_foo
min: 0
max: 100
- type: unique
column: field_foo
- type: custom_sql
sql: SELECT COUNT(*) FROM SampleHiveDataset
operator:
type: greater_than
value: 100

0 comments on commit 5adb799

Please sign in to comment.