Skip to content

add localstack-bruin: Bruin data pipeline on LocalStack S3 + Snowflake - #15

Merged
whummer merged 3 commits into
mainfrom
add-localstack-bruin-sample
Oct 4, 2026
Merged

whummer merged 3 commits into
mainfrom
add-localstack-bruin-sample

Conversation

@whummer

@whummer whummer commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

New sample in localstack-bruin/ that runs a Bruin pipeline fully locally against LocalStack, using both AWS (S3) and the Snowflake emulator (localstack/snowflake-next).

s3://shop-raw (CSV) -> Snowflake stage + COPY INTO -> RAW.* -> ANALYTICS.ORDERS_ENRICHED (+ quality checks)
  -> ANALYTICS.REVENUE_BY_COUNTRY -> COPY INTO @stage (unload) -> s3://shop-reports/revenue_by_country.json
  • raw.shop_data: Snowflake external stage on a LocalStack S3 bucket, COPY INTO ... MATCH_BY_COLUMN_NAME from CSV
  • analytics.orders_enriched: join in Snowflake plus data quality checks that fail the run on bad data
  • analytics.revenue_by_country: aggregation in Snowflake, unloaded as JSON straight to LocalStack S3
  • make all / make test for local runs, plus .github/workflows/test-localstack-bruin.yml running the flow end to end in CI

Notes

  • Two containers via docker compose: localstack/localstack-pro (S3, port LOCALSTACK_PORT, default 4566) and localstack/snowflake-next (port SNOWFLAKE_PORT, default 4567). Snowflake reaches S3 for external stages via SF_S3_ENDPOINT=http://localstack:4566.
  • Bruin's native Snowflake connection has no host option (always *.snowflakecomputing.com), so the Snowflake steps are Bruin Python assets that get the connection injected as a secret and connect to snowflake.localhost.localstack.cloud.
  • .bruin.yml is committed on purpose since it only holds LocalStack's dummy test credentials. Bruin auto-adds it to .gitignore, so the sample's .gitignore re-includes it.
  • Root .gitignore gets Bruin's logs/ entries (Bruin appends them on first run).
  • CI uses the TEST_LOCALSTACK_SNOWFLAKE_AUTH_TOKEN secret, since the default test token has no Snowflake license. make wait fails fast if the license message shows up.

Test plan

  • Pipeline green locally on snowflake-next, reruns idempotent, report totals match the source CSVs
  • Bad-data case (order with unknown customer) fails the quality check and skips the downstream asset
  • CI workflow green

🤖 Generated with Claude Code

whummer and others added 3 commits October 5, 2026 03:45
Sample Bruin pipeline that loads raw CSVs from LocalStack S3 into the
LocalStack Snowflake emulator (external stage + COPY INTO), transforms
them with data quality checks, and writes a report back to S3. Includes
a CI workflow that runs the pipeline end to end and checks the report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssing license

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run LocalStack (S3) and localstack/snowflake-next side by side, with
external stages reaching S3 via SF_S3_ENDPOINT. This drops the earlier
emulator workarounds: COPY uses a stage-level file format with
MATCH_BY_COLUMN_NAME, and the report is unloaded from Snowflake to S3
with COPY INTO @stage instead of boto3. Ports are configurable via
LOCALSTACK_PORT / SNOWFLAKE_PORT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@whummer
whummer merged commit c6c9312 into main Oct 4, 2026
1 check passed
@whummer
whummer deleted the add-localstack-bruin-sample branch October 4, 2026 19:53
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.

1 participant