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

dbt init profile_template.yml improvements #4118

Merged
merged 3 commits into from
Oct 22, 2021
Merged

dbt init profile_template.yml improvements #4118

merged 3 commits into from
Oct 22, 2021

Conversation

NiallRees
Copy link
Contributor

@NiallRees NiallRees commented Oct 22, 2021

Follow up to #3625

  • Rename target's target_options.yml to profile_template.yml
  • A profile_template.yml in the project's root now just overrides the target's profile_template.yml, they have the same format
  • Update the format of profile_template.yml from
_fixed_type: postgres
threads:
  hint: '1 or more'
  type: 'int'
  default: 1
host:
  hint: 'hostname for the instance'
port:
  default: 5432
  type: 'int'
user:
  hint: 'dev username'
pass:
  hint: 'dev password'
  hide_input: true
dbname:
  hint: 'default database that dbt will build objects in'
schema:
  hint: 'default schema that dbt will build objects in'

to

fixed:
  type: postgres
prompts:
  host:
    hint: 'hostname for the instance'
  port:
    default: 5432
    type: 'int'
  user:
    hint: 'dev username'
  pass:
    hint: 'dev password'
    hide_input: true
  dbname:
    hint: 'default database that dbt will build objects in'
  schema:
    hint: 'default schema that dbt will build objects in'
  threads:
    hint: '1 or more'
    type: 'int'
    default: 1

@cla-bot cla-bot bot added the cla:yes label Oct 22, 2021
@NiallRees NiallRees changed the title Update profile_template.yml to use same syntax as target_options.yml dbt init profile_template.yml improvements Oct 22, 2021
@@ -63,7 +62,7 @@ def copy_starter_repo(self, project_name):
def create_profiles_dir(self, profiles_dir: str) -> bool:
"""Create the user's profiles directory if it doesn't already exist."""
profiles_path = Path(profiles_dir)
if profiles_path.exists():
if not profiles_path.exists():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug fix!

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

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

I love it, I'm all about it

Especially cool is that you can define profile_template.yml for your project, even if your adapter plugin has not yet defined the defaults. Of course, it's super easy if you can just copy-paste the plugin defaults, and change prompts into fixed

@jtcohen6 jtcohen6 merged commit 3397bdc into dbt-labs:main Oct 22, 2021
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
* Update profile_template.yml to use same syntax as target_options.yml

* Rename target_options to profile_template

* Update profile_template config spec

automatic commit by git-black, original commits:
  11436fe
  3397bdc
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
* Update profile_template.yml to use same syntax as target_options.yml

* Rename target_options to profile_template

* Update profile_template config spec

automatic commit by git-black, original commits:
  3397bdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants