Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give profiles some love #1958

Closed
clrcrl opened this issue Nov 26, 2019 · 14 comments
Closed

Give profiles some love #1958

clrcrl opened this issue Nov 26, 2019 · 14 comments
Labels
enhancement New feature or request stale Issues that have gone stale

Comments

@clrcrl
Copy link
Contributor

clrcrl commented Nov 26, 2019

I recently rewrote some docs on connecting to your data warehouse when using dbt Core.

In doing so, I started to thing pretty hard about whether the names/structure we've used so far are still a good fit.

Some random thoughts:

  • I think folks sometimes think that because targets are named a “target”, there’s also somewhere to define a “source”. Is “target” a misleading word? Is envs a better word instead?
  • The current structure has some weirdness in it, e.g. “targets” are listed under the “outputs” key.
  • The keys “schema” and “default” are not descriptive enough — is “schema” the schema I’m reading from or writing to? “default” what? Oh, default output default target.
  • When defining multiple targets for a profile, you have to repeat connection details

Here's my proposed new schema:

version: 2

profiles: # should this be connections instead?
- name: jaffle_shop
  default_env: dev
  connection_details: # this isn’t the right key name... yet, but this is the default connection details, which you can override in a particular target. 
    type: redshift
    host: xyz
    ....
    user: abc
    pw: pas55w0rd
  envs:
    - name: dev
      target_schema: dbt_claire
      connection_details: # here you can override/add to anything defined above
        user: claire
        password: pa55w0rd
    - name: prod
      target_schema: analytics
      connection_details: 
        user: claire_super
        password: pa55w0rd
@clrcrl clrcrl added enhancement New feature or request triage labels Nov 26, 2019
@clrcrl
Copy link
Contributor Author

clrcrl commented Jan 6, 2020

Evidence from Slack:

Nick S Today at 11:04 AM
Hi Everyone, I'm new to dbt and trying to figure out something which may be frowned upon.
We have a lot of data sources coming in to the warehouse, each source going to its own schema.
There may be cases where we would want to create a model using data from multiple schemas. Is this possible at all with dbt?
...

Nick S 3 minutes ago
Ooo ok I missed where you can override schema in sources. How well does this play with a schema set in profile?

Nick S 2 minutes ago
Ah I think I understand what I've missed here

Nick S 2 minutes ago
the profile specifies the target - where the models will be built. But doesn't specify the source schema.

@drewbanin drewbanin removed the triage label Jan 21, 2020
@drewbanin
Copy link
Contributor

Thanks for raising this issue @clrcrl - I agree that we'll want to update the profile specification syntax, and I do like the structure you've outlined here.

The addition of a version number is a really good idea - it will make the upgrade path for users significantly easier, especially since this is a cosmetic change that users don't need to make right away.

I think a good name for connection_details could just be connection. Is there a specific reason you don't like that name?

Some thoughts that pop into my head as I look at this:

  • if we change targets to envs, we'll probably also want to update the --target flag on the CLI
  • this is more complicated to write than the existing profiles.yml structure. I think it's better, but we should probably anticipate that folks who are new to yaml could have trouble with the distinction between lists and dicts.
  • I love that this format doesn't require you to repeat creds for dev/prod envs
  • since the list of envs is a list (instead of a dict), we don't strictly need a default_env key to be present. Users could add that if they want to set a default, but dbt could otherwise just use the first env in the list (just a thought).

Let me know what you think about all of this

@clrcrl
Copy link
Contributor Author

clrcrl commented May 26, 2020

More evidence:

Stephen Lloyd
I’m trying to understand how to set up profiles to have more than one environment. I don’t fully understand the difference between target and outputs.

I somehow missed this reply:

  • connection_details vs connection: happy to use connection here!
  • I like the default env idea!

@jaypeedevlin
Copy link
Contributor

I just spent a good amount of time trying to work out how targets relate to outputs in order to help a colleague get setup in dbt cloud. A big +1 on this!!

@jtcohen6
Copy link
Contributor

jtcohen6 commented Mar 1, 2021

Let's give this some consideration in advance of v1.0. I'm going to close #1165 in favor of this proposal.

@leahwicz
Copy link
Contributor

  • Update the start-project profile when we do this work

@nathaniel-may
Copy link
Contributor

  • What is the exit criteria for this issue?
    • target renamed to envs
    • no more output section:
      • name, default_env, connection, envs for each yaml array element in profiles
      • name, target_schema, connection_details (overrides) for each array element in envs.
    • update --target flag on cli to a new name (TODO: to what? env?)
    • add alias for the jinja context variable called target with the new name
    • update init command to use the new version syntax
    • backwards compatible: you can use either v1 or v2.
  • What are the high-level items of the work that need to be done (i.e. create x, split out y, etc.)
    • add version 2 to profiles parser
    • parse new structure
    • update target flag
    • update init command
    • add/modify integration tests to test the new profiles version
  • What are the open questions on this issue that still need answers?
    • What is the new target flag name?
  • Are there blockers/prerequisites to starting this work?
    • I think it could be started.

@jtcohen6 jtcohen6 removed the 1.0.0 Issues related to the 1.0.0 release of dbt label Nov 11, 2021
@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label May 11, 2022
@jaypeedevlin
Copy link
Contributor

Commenting to stop this one being auto-closed, although dbt Labs folks feel free to overrule me.

I think this remains a confusing part of the dbt experience, which is especially important as it's often one of the first things a new dbt-core user has to work out. I'd love to see this targeted for 2.0 (and would be happy to contribute in part as much as I have the technical ability to).

@jtcohen6 jtcohen6 removed the stale Issues that have gone stale label May 11, 2022
@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Nov 12, 2022
@github-actions
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers.

@jtcohen6 jtcohen6 removed the stale Issues that have gone stale label Nov 20, 2022
@jtcohen6
Copy link
Contributor

Reopening for now - I'd be excited to refactor profiles.yml next year :)

@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label May 20, 2023
@github-actions
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

6 participants