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 with provided project name #4249

Merged
merged 5 commits into from
Nov 10, 2021

Conversation

kadero
Copy link
Contributor

@kadero kadero commented Nov 9, 2021

resolves #4156

Description

Aim of this PR is to support dbt init <project_name> and to be able to skip the adapter configuration via dbt init -s. Of course, we can also combine the arguments <project_name> and -s.

Examples:
dbt init jaffle_shop
image

dbt init -s
image

dbt init jaffle_shop -s
image

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change

@cla-bot cla-bot bot added the cla:yes label Nov 9, 2021
@kadero kadero force-pushed the feature/dbt_init_with_project_name branch 2 times, most recently from aff81ac to 89cae6e Compare November 9, 2021 09:34
@kadero kadero force-pushed the feature/dbt_init_with_project_name branch 2 times, most recently from e7ef137 to 3765b8e Compare November 9, 2021 09:54
@kadero kadero force-pushed the feature/dbt_init_with_project_name branch from 3765b8e to 6f1fc80 Compare November 9, 2021 09:55
@kadero kadero marked this pull request as ready for review November 9, 2021 09:56
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.

Looks great to me, @kadero! I'm going to sneak this in for rc1. Thanks so much for another solid contribution :)

Comment on lines +319 to +328
self.copy_starter_repo(project_name)
os.chdir(project_name)
with open("dbt_project.yml", "r+") as f:
content = f"{f.read()}".format(
project_name=project_name,
profile_name=project_name
)
f.seek(0)
f.write(content)
f.truncate()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be great, in the future, to add another log/event here to explain what's happening. That way:

$ dbt init my_new_project -s
11:54:50 | [ info  ] | Running with dbt=1.0.0-b2
11:54:51 | [ info  ] | Created starter project named 'my_new_project'

That can come in another future pass

@jtcohen6 jtcohen6 merged commit 40321d7 into dbt-labs:main Nov 10, 2021
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
* Dbt init with provided project name

* Update changelog.md

* Fix changelog.md

* Fix typo in help

Co-authored-by: Jeremy Cohen <[email protected]>

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

Successfully merging this pull request may close these issues.

Re-add support for dbt init <project_name>
2 participants