Skip to content

dbt-prefect path handling for DbtCoreOperation can not handle spaces nor escaping in paths #18026

@dumkydewilde

Description

@dumkydewilde

Bug summary

The _append_dirs_to_commands function does not add the paths in quotes, meaning that if a path contains a space the generated shell script will fail. Unfortunately escaping with a \ also fails since relative_path_to_current_platform() replaces all backslashes.

Minimal example:

result = DbtCoreOperation(
        commands=[
            "dbt debug"
            ],
        project_dir=os.getenv("DBT_PROJECT_DIR", "/local user name with spaces/my_dbt_project")
    ).run()

Version info

3.4.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions