use chrono::{DateTime, Utc};
use clap::Parser;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
pub struct Args {
pub path: String,
#[clap(short, long, default_value_t = String::from("select * from tbl"), group = "sql")]
pub query: String,
#[clap(short, long, group = "sql")]
pub schema: bool,
#[clap(short, long, default_value_t = 10)]
pub limit: usize,
#[clap(short, long)]
pub profile: Option<String>,
#[clap(
short,
long,
help = "Timestamp to load deltatable in RFC format, eg: 2022-01-13T16:39:00+01:00"
)]
pub at: Option<DateTime<Utc>>,
}
impl Args {
pub fn get_query(&self) -> &str {
let query = if self.schema {
"SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = 'tbl'"
} else {
self.query.as_str()
};
query
}
}