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 should be able to create a project in the current directory #1121

Closed
tconbeer opened this issue Nov 13, 2018 · 8 comments
Closed

dbt init should be able to create a project in the current directory #1121

tconbeer opened this issue Nov 13, 2018 · 8 comments
Labels
good_first_issue Straightforward + self-contained changes, good for new contributors! init Issues related to initializing the dbt starter project stale Issues that have gone stale

Comments

@tconbeer
Copy link
Contributor

Feature

dbt_init should be able to create a project in the current directory

Feature description

Sometimes its's helpful to create a new dbt project in the current directory, rather than in a new directory. One example is when using dbt with pipenv. Ideally this sequence of commands would install dbt from scratch in a virtual environment, and then create a dbt project in that same directory:

> mkdir dbt\my-dbt-project
> cd my-dbt-project
> pipenv install dbt
> pipenv run dbt init

If dbt needs a project name, it could take it from the path or take a different argument to override the default "create a directory" behavior
> pipenv run dbt init my-dbt-project --current-directory

Who will this benefit?

People creating a new dbt project who plan on collaborating and require specific dbt versions to be installed across multiple machines.

@clrcrl clrcrl added the good_first_issue Straightforward + self-contained changes, good for new contributors! label Nov 13, 2018
@drewbanin drewbanin added this to the Wilt Chamberlain milestone Nov 28, 2018
@cmcarthur cmcarthur removed this from the Wilt Chamberlain milestone May 1, 2019
@drewbanin drewbanin added the stale Issues that have gone stale label Nov 26, 2019
@drewbanin
Copy link
Contributor

this is a reasonable idea, but I don't think it's something we're going to prioritize any time soon. Closing, but we can re-open if anyone feels strongly

@thomashandorf
Copy link

this is bugging me for some time. It different from the semantics of other tools. E.g. 'git init' . It would be event great if it would ask in the first step to take the current directory or a subdirectory

@jtcohen6 jtcohen6 added the init Issues related to initializing the dbt starter project label Sep 23, 2022
@jtcohen6
Copy link
Contributor

More recent issue proposing something similar: #4141

I'm not strictly opposed, if lots of folks want this

@thomashandorf
Copy link

Great to hear. I often have the workflow: create repo on github, clone repo to local, try to init dbt - damn ;)

@schlich
Copy link

schlich commented Oct 17, 2023

I think this should be supported in the CLI. The current workaround is a pain if you'd like to use dbt's root-level configuration if you don't want to use the dbt cli to bootstrap the project. For example, I use poetry new to bootstrap my python projects and it makes much more sense to handle the installation of dbt first with poetry and configure the dbt config second. I shouldn't have to need mv for what others have mentioned is a basic cli option in many tools (git was mentioned, but also see poetry init vs poetry new).

@emilyriederer
Copy link

Upvoting this for the same use case as @schlich . I've been experimenting with switching to poetry for virtual environment management with dbt. Currently, it feels a bit clumsy to need the last two lines in:

poetry init
poetry add dbt-core
poetry add dbt-duckdb
dbt init 
cp -r dbt_demo/* .
rm -rf dbt_demo

@schlich
Copy link

schlich commented Dec 4, 2023

@emilyriederer i'd still like to see first class support for this feature (particularly I think there are some details around getting the name of the profiles/paths right that need to be considered) but just as an FYI your workaround can be shortened to one line instead of two by using mv instead of cp 🙂 (edit: i guess you'd still have the empty directory sitting there, but it would at least avoid getting picked up by git).

@matthias-fbi
Copy link

Any updates on this?

I create a folder with an .venv inside, install dbt + connector and then try to run dbt init -> "A project called test_dbt already exists here"

But I need a .venv first to run dbt init in the first place but then can't run dbt init because of that .... ?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good_first_issue Straightforward + self-contained changes, good for new contributors! init Issues related to initializing the dbt starter project stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

9 participants