8000 Minor improve main opendbt cli code by ismailsimsek · Pull Request #63 · memiiso/opendbt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Minor improve main opendbt cli code #63

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

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions opendbt/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@


def main():
p = argparse.ArgumentParser()
p.add_argument('--project-dir', default=None)
ns, args = p.parse_known_args()
if ns.project_dir is None:
ns.project_dir = os.environ.get('DBT_PROJECT_DIR', Path.cwd())
parser = argparse.ArgumentParser(description="OpenDBT CLI")
parser.add_argument(
"--project-dir",
default=os.environ.get("DBT_PROJECT_DIR"),
help="Path to the dbt project directory. Defaults to the DBT_PROJECT_DIR environment variable or the current working directory.",
)
parser.add_argument(
"--profiles-dir",
default=os.environ.get("DBT_PROFILES_DIR"),
help="Path to the dbt profiles directory. Defaults to the DBT_PROFILES_DIR environment variable.",
)
ns, args = parser.parse_known_args()
project_dir = Path(ns.project_dir) if ns.project_dir else Path.cwd()
profiles_dir = Path(ns.profiles_dir) if ns.profiles_dir else None

OpenDbtCli(project_dir=Path(ns.project_dir)).invoke(args=args)
OpenDbtCli(project_dir=project_dir, profiles_dir=profiles_dir).invoke(args=args)


if __name__ == "__main__":
Expand Down
0