dbt-labs / jaffle-shop-template

Template for a DuckDB-based, Codespace-oriented sandbox project that is also dbt Cloud compatible, and includes code-first BI tooling via Evidence.
51 stars 30 forks source link

Add install and db env vars to devcontainer #14

Closed hughess closed 1 year ago

hughess commented 1 year ago

This template is fantastic!

We've been thinking of ways to make it easier to get started with the reports directory and came up with these ideas:

  1. Add npm install to the postCreateCommand in .devcontainer/devcontainer.json so it doesn't need to be run the first time you go into the reports directory
  2. Add environment variables for the duckdb connection so you don't need to enter them in the settings menu in Evidence

Before these changes, the steps to get started would be:

  1. cd reports
  2. npm install
  3. npm run dev
  4. Settings > enter db info

Afterwards, the steps would be:

  1. cd reports
  2. npm run dev

Database Environment Variables

In this PR, I've set the following environment variables so Evidence can automatically pick up the db connection:

I noticed that @aaronsteers recently added a way to dynamically set db and schema names, so this may conflict with that approach. If this conflicts with those variables, I can remove these from the PR!

gwenwindflower commented 1 year ago

@hughess sorry this week has been hectic and i missed that you added npm in here in addition to the env vars, i just merged that in on another branch where i was doing stuff with the postCreateCommand. Can you revert that change and just PR the env vars. Sorry about that!

i can also just add the env vars myself if that's easier than messing with that - lmk!

i was just about to post in the Evidence slack to brainstorm about solutions to needing to go to Settings on load every time when i saw this, awesome stuff, excited to solve that.

gwenwindflower commented 1 year ago

i went ahead and just threw them on a new branch 👍🏻 works great running into some problems, sent a Loom

hughess commented 1 year ago

@gwenwindflower no problem at all, thanks for doing that! I'll close this PR

I also replied in slack - we think it's a v14 issue that's causing the problem. We've got a fix in the works!