buster/cli/src/main.rs

48 lines
969 B
Rust
Raw Normal View History

mod commands;
mod error;
mod types;
mod utils;
use clap::{Parser, Subcommand};
use commands::{auth, deploy, deploy_v2, generate, import, init};
pub const APP_NAME: &str = "buster";
#[derive(Subcommand)]
Dal/cli-updates-skip-dbt (#67) * feat: enhance deploy command with skip_dbt option - Updated the Deploy command to accept a `skip_dbt` boolean argument, allowing users to bypass the dbt run during deployment. - Refactored the deploy function to conditionally execute the dbt command based on the `skip_dbt` flag, improving deployment flexibility. * Refactor query engine and CLI commands for improved functionality and error handling - Updated `get_bigquery_columns` and `get_snowflake_columns` functions to enhance column name handling and ensure proper error reporting. - Modified `get_snowflake_client` to accept a database ID for better connection management. - Enhanced the `deploy` command in the CLI to include additional parameters (`path`, `data_source_name`, `schema`, `env`) for more flexible deployments. - Improved error handling and reporting in the `deploy` function, including detailed summaries of deployment errors and successful file processing. - Updated `get_model_files` to accept a directory path and added checks for file existence, enhancing robustness. - Adjusted model file structures to include schema information and refined the upload process to handle optional parameters more effectively. These changes collectively improve the usability and reliability of the query engine and deployment process. * Update dataset DDL generation to include optional YML file content - Modified `generate_sql_agent` to append optional YML file content to dataset DDL - Ensures more comprehensive dataset representation during SQL agent generation - Handles cases where YML file might be present or absent gracefully
2025-01-25 08:00:38 +08:00
#[clap(rename_all = "kebab-case")]
pub enum Commands {
Init,
Auth,
Generate,
Import,
Dal/cli-updates-skip-dbt (#67) * feat: enhance deploy command with skip_dbt option - Updated the Deploy command to accept a `skip_dbt` boolean argument, allowing users to bypass the dbt run during deployment. - Refactored the deploy function to conditionally execute the dbt command based on the `skip_dbt` flag, improving deployment flexibility. * Refactor query engine and CLI commands for improved functionality and error handling - Updated `get_bigquery_columns` and `get_snowflake_columns` functions to enhance column name handling and ensure proper error reporting. - Modified `get_snowflake_client` to accept a database ID for better connection management. - Enhanced the `deploy` command in the CLI to include additional parameters (`path`, `data_source_name`, `schema`, `env`) for more flexible deployments. - Improved error handling and reporting in the `deploy` function, including detailed summaries of deployment errors and successful file processing. - Updated `get_model_files` to accept a directory path and added checks for file existence, enhancing robustness. - Adjusted model file structures to include schema information and refined the upload process to handle optional parameters more effectively. These changes collectively improve the usability and reliability of the query engine and deployment process. * Update dataset DDL generation to include optional YML file content - Modified `generate_sql_agent` to append optional YML file content to dataset DDL - Ensures more comprehensive dataset representation during SQL agent generation - Handles cases where YML file might be present or absent gracefully
2025-01-25 08:00:38 +08:00
Deploy {
#[arg(long)]
path: Option<String>,
},
}
#[derive(Parser)]
pub struct Args {
#[command(subcommand)]
pub cmd: Commands,
}
#[tokio::main]
async fn main() {
let args = Args::parse();
// TODO: All commands should check for an update.
let result = match args.cmd {
Commands::Init => init().await,
Commands::Auth => auth().await,
Commands::Generate => generate().await,
Commands::Import => import().await,
Commands::Deploy { path } => deploy_v2(path.as_deref()).await,
};
if let Err(e) = result {
eprintln!("{}", e);
std::process::exit(1);
}
}