Skip to content

feat(elt-pipelines): dbt project with electricity_sharepoint transform - #429

Merged
WHTaylor merged 8 commits into
mainfrom
421-transform-docs
Aug 14, 2026
Merged

feat(elt-pipelines): dbt project with electricity_sharepoint transform#429
WHTaylor merged 8 commits into
mainfrom
421-transform-docs

Conversation

@WHTaylor

Copy link
Copy Markdown
Contributor

ref #421

Puts in enough of the transform functionality to get elt run facility_ops electricity_sharepoint --step transform working.

  • Copies the existing dbt project into elt-pipelines
  • Cuts out all the models/marts besides the ones for the electricity_sharepoint transform - the others need changes to work with schema changes
  • Updates docs
  • Fix a test expectation

This is the copied directly from the warehouses/facility_ops/transform
directory, omitting the other transforms. They don't currently work
because of schema changes between the warehouses and elt-pipelines ingest
steps, so will be ported separately, but the
electricity_sharepoint -> power_consumption transform works without changes.
@WHTaylor
WHTaylor requested a review from a team as a code owner August 12, 2026 15:15
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 089247c7-b7d1-48ff-81b0-f7628124f9ef

📥 Commits

Reviewing files that changed from the base of the PR and between 2595d86 and b2182c8.

📒 Files selected for processing (3)
  • elt-pipelines/facility_ops/transform/README.md
  • elt-pipelines/facility_ops/transform/macros/parse_utc_timestamp.sql
  • elt-pipelines/facility_ops/transform/profiles.yml
🚧 Files skipped from review as they are similar to previous changes (3)
  • elt-pipelines/facility_ops/transform/macros/parse_utc_timestamp.sql
  • elt-pipelines/facility_ops/transform/README.md
  • elt-pipelines/facility_ops/transform/profiles.yml

📝 Walkthrough

Walkthrough

The pull request adds a Facility Operations dbt project with Trino profiles, SQLFluff rules, dependencies, reusable macros, electricity staging and accelerator models, documentation, and SQL fixtures.

Changes

Facility Operations transformation

Layer / File(s) Summary
Project setup and execution configuration
elt-pipelines/README.md, elt-pipelines/facility_ops/transform/...
Adds dbt project settings, local and remote Trino profiles, package and Python dependencies, SQLFluff settings, ignore rules, and execution documentation.
Reusable transformation macros
elt-pipelines/facility_ops/transform/macros/*
Adds adapter-dispatched whitespace normalisation, equipment category key creation, and Trino UTC timestamp parsing macros.
Electricity staging and accelerator models
elt-pipelines/facility_ops/transform/models/staging/estates/*, elt-pipelines/facility_ops/transform/models/marts/accelerator/*
Defines the electricity source, renames staging fields, and adds the partitioned power_consumption model with column metadata and non-null tests.
SQL transformation fixtures
elt-pipelines/facility_ops/transform/tests/fixtures/*
Adds fixtures for Opralogweb logbooks, chapters, entries, additional columns, and Statusdisplay cycles and phases.

Possibly related PRs

Suggested labels: enhancement

Mergeability Score: ⚪ Minimal · up to b2182

This PR adds the scoped electricity SharePoint transformation and supporting project files; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the new dbt project and electricity_sharepoint transform in elt-pipelines.
Description check ✅ Passed The description accurately explains the transform functionality, scope, documentation updates, and corrected test expectation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@elt-pipelines/facility_ops/transform/macros/parse_utc_timestamp.sql`:
- Around line 7-12: Update trino__parse_utc_timestamp so its precision contract
matches parse_datetime: either restrict time_format to at most millisecond
fractional precision before parsing, or replace parse_datetime with a parser
that preserves timestamp(6) precision. Ensure the cast does not imply recovery
of digits already discarded by parsing.
- Around line 7-15: Update trino__parse_utc_timestamp to parse the combined
date/time with an explicit src_timezone, or use a time-zone-free parser, so
DST-gap and ambiguous fall-back values are resolved in the source zone rather
than the Trino session zone. Preserve microsecond precision by avoiding
parse_datetime when fractional seconds are supported, and add coverage for
spring-forward and fall-back cases.

In `@elt-pipelines/facility_ops/transform/profiles.yml`:
- Around line 24-26: Update the remote LDAP profile’s http_scheme setting to
require https instead of reading DBT_TRINO_HTTP_SCHEME, while leaving the user
and password environment variables unchanged and keeping HTTP configuration
separate from LDAP credentials.

In `@elt-pipelines/facility_ops/transform/requirements/requirements.txt`:
- Around line 22-23: Regenerate both lockfiles,
elt-pipelines/facility_ops/transform/requirements/requirements.txt lines 22-23
and elt-pipelines/facility_ops/transform/requirements/developer.txt lines 24-27,
so Click resolves to 8.3.3 or later instead of the affected versions. Validate
compatibility with the dbt CLI and SQLFluff dependency sets.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 279b9e17-0311-4d44-aa22-13efe5b0c28c

📥 Commits

Reviewing files that changed from the base of the PR and between 5372b6c and 2595d86.

📒 Files selected for processing (33)
  • elt-pipelines/README.md
  • elt-pipelines/facility_ops/transform/.gitignore
  • elt-pipelines/facility_ops/transform/.sqlfluff
  • elt-pipelines/facility_ops/transform/.sqlfluffignore
  • elt-pipelines/facility_ops/transform/README.md
  • elt-pipelines/facility_ops/transform/analyses/.gitkeep
  • elt-pipelines/facility_ops/transform/dbt_project.yml
  • elt-pipelines/facility_ops/transform/macros/create_equipment_category_key.sql
  • elt-pipelines/facility_ops/transform/macros/normalize_whitespace.sql
  • elt-pipelines/facility_ops/transform/macros/parse_utc_timestamp.sql
  • elt-pipelines/facility_ops/transform/models/marts/accelerator/power_consumption.sql
  • elt-pipelines/facility_ops/transform/models/marts/accelerator/power_consumption.yml
  • elt-pipelines/facility_ops/transform/models/staging/estates/_estates__sources.yml
  • elt-pipelines/facility_ops/transform/models/staging/estates/stg_electricity_sharepoint_rdm_data.sql
  • elt-pipelines/facility_ops/transform/models/staging/estates/stg_electricity_sharepoint_rdm_data.yml
  • elt-pipelines/facility_ops/transform/package-lock.yml
  • elt-pipelines/facility_ops/transform/packages.yml
  • elt-pipelines/facility_ops/transform/profiles.yml
  • elt-pipelines/facility_ops/transform/requirements/developer.in
  • elt-pipelines/facility_ops/transform/requirements/developer.txt
  • elt-pipelines/facility_ops/transform/requirements/requirements.in
  • elt-pipelines/facility_ops/transform/requirements/requirements.txt
  • elt-pipelines/facility_ops/transform/seeds/.gitkeep
  • elt-pipelines/facility_ops/transform/snapshots/.gitkeep
  • elt-pipelines/facility_ops/transform/tests/.gitkeep
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_opralogweb__additional_columns.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_opralogweb__chapter_entry.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_opralogweb__entries.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_opralogweb__logbook_chapter.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_opralogweb__logbooks.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_opralogweb__more_entry_columns.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_statusdisplay__cycles.sql
  • elt-pipelines/facility_ops/transform/tests/fixtures/base_statusdisplay__cycles__phases.sql

Comment thread elt-pipelines/facility_ops/transform/macros/parse_utc_timestamp.sql Outdated
Comment thread elt-pipelines/facility_ops/transform/macros/parse_utc_timestamp.sql
Comment thread elt-pipelines/facility_ops/transform/profiles.yml Outdated
Comment thread elt-pipelines/facility_ops/transform/requirements/requirements.txt
@WHTaylor

Copy link
Copy Markdown
Contributor Author

@martyngigg do you have thoughts on any of the rabbit comments? I don't know enough about this to understand the nuances, and they mostly seem somewhat borderline on how to address them.

@martyngigg

Copy link
Copy Markdown
Member

@martyngigg do you have thoughts on any of the rabbit comments? I don't know enough about this to understand the nuances, and they mostly seem somewhat borderline on how to address them.

I'll take a look at the code related ones. For the dependencies can we remove the requirements/ directory and use the pyproject.toml in the elt-pipelines root?

These are included transitively from elt-common via elt-pipelines.

The dbt-adapater dependency is provided transitively by dbt-trino.

For the pinned dependency, it looks like it may have been fixed upstream. If not, I'll look at fixing it when it causes problems.
@WHTaylor
WHTaylor requested a review from a team as a code owner August 13, 2026 10:42
#429 (comment)

It's unlikely we need to handle sub millisecond precision timestamps represented by strings, so this should be fine for now
#429 (comment)

Without the tz information during parse_datetime, the tz of the trino session is used. This means that during daylight savings there would be an hour difference applied to any data collected as UTC

This does now mean there's a problem in the other direction (if the data was collected during daylight savings), but I guess anyone storing daylight savings times without timezones is unlikely to miss an hour here or there.
@WHTaylor

Copy link
Copy Markdown
Contributor Author

Sorry for all the individual pushes, I kept forgetting things I hadn't addressed 😓

There's a kind of funny 'warning' at the moment The selection criterion 'resource_type:unit_test' does not match any enabled nodes which is coming from the exclusion of that criteria in _common_excludes. It'll go away when tests are added back as part of porting the other transforms.

@martyngigg

Copy link
Copy Markdown
Member

Sorry for all the individual pushes, I kept forgetting things I hadn't addressed 😓

No worries!

There's a kind of funny 'warning' at the moment The selection criterion 'resource_type:unit_test' does not match any enabled nodes which is coming from the exclusion of that criteria in _common_excludes. It'll go away when tests are added back as part of porting the other transforms.

Happy to live with this for now.

@WHTaylor
WHTaylor merged commit 38f237a into main Aug 14, 2026
3 checks passed
@WHTaylor
WHTaylor deleted the 421-transform-docs branch August 14, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants