Open digitalghost-dev opened 4 months ago
I edited core/dbt/task/init.py
on my machine and it works when editing the create_profiles_dir
function:
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)
profiles_dir_str = str(profiles_path) # Convert PosixPath object to string
if not profiles_path.exists():
fire_event(ConfigFolderDirectory(dir=profiles_dir_str))
dbt.clients.system.make_directory(profiles_dir_str)
return True
return False
Thanks for reaching out about this @digitalghost-dev ! And thanks for testing out that code change as well 🤩
I tried to replicate this error, but running dbt init
worked for me with Python 3.10.10 and dbt-core 1.7.10.
A couple follow-up questions:
Which version of protobuf
do you have installed?
pip list | grep protobuf
dbt-core==1.7.10
requires protobuf>=4.0.0,<5.0.0
-- 5.26.0
will not work (see https://github.com/dbt-labs/dbt-core/issues/9759)If protobuf is not the issue, could you try installing and running in an environment other than Python 3.12 (like 3.11 or 3.10) and see if it still has the same problem?
Hey @dbeatty10 - protobuf is showing version 4.25.3
I tried it with Python v3.11.6
and looks like it worked.
Thanks for testing that out @digitalghost-dev 💪
The root cause appears to be that dir
is expected to be a string here and here.
A minimal fix might be updating this: https://github.com/dbt-labs/dbt-core/blob/65b366bca904ef741bedae255dfdbc3837f4d2e9/core/dbt/task/init.py#L69
to this:
fire_event(ConfigFolderDirectory(dir=str(profiles_dir)))
But we'll leave it to one of our software engineers to make the decision how they want to address this.
Alright, @dbeatty10, thanks for looking at this with me. The small patch I made got me up and running for the time being.
Thanks for the conversation here, I hit the same issue with dbt as part of dagster-dbt. For me I was able to simply make the .dbt
directory manually.
Is this a new bug in dbt-core?
Current Behavior
Installing
dbt-core
on a new machine, unable to rundbt init
.Expected Behavior
Hoping to initialize a new dbt profile.
Steps To Reproduce
dbt-bigquery
dbt init
Relevant log output
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
No response