Skip to content
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

chore: update cargo dependencies #536

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
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
103 changes: 72 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ license = "Apache-2.0"
rust-version = "1.80.0"

[workspace.dependencies]
cargo-nextest = "0.9"
sqlinference = { git = "https://github.com/quarylabs/sqruff.git", package = "sqruff-sqlinference" }
sqruff-lib-core = { git = "https://github.com/quarylabs/sqruff.git", package = "sqruff-lib-core" }
sqruff-lib-dialects = { git = "https://github.com/quarylabs/sqruff.git", package = "sqruff-lib-dialects" }

[workspace.dev-dependencies]
cargo-nextest = "0.9"

3 changes: 3 additions & 0 deletions rust/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ base64 = "0.22.1"
dotenv = "0.15"
serde_yaml = "0.9.33"
duckdb = { version = "1.0.0", features = ["bundled"] }
sqlinference.workspace = true
sqruff-lib-core.workspace = true
sqruff-lib-dialects.workspace = true

[dev-dependencies]
chrono = "0.4.38"
Expand Down
4 changes: 3 additions & 1 deletion rust/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,13 @@ async fn main_wrapped() -> Result<(), String> {

// TODO Need to reintroduce the progressbar
println!("running tests {}", tests.len());
let dialect = query_generator.get_dialect();
let parser = sqruff_lib_core::parser::parser::Parser::new(&dialect, Default::default());
return match run_tests_internal(
&query_generator,
&file_system,
&project,
&query_generator.get_dialect(),
&parser,
mode,
func,
test_args.full_source,
Expand Down
7 changes: 4 additions & 3 deletions rust/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ rust-version.workspace = true
crate-type = ["cdylib", "rlib"]

[dependencies]
prost = { default-features = false, version = "0.13" }
quary_proto = { path = "../../proto/gen/rust" }
sqlinference = { git = "https://github.com/quarylabs/sqruff.git", package = "sqruff-sqlinference" }
sqruff = { git = "https://github.com/quarylabs/sqruff.git", package = "sqruff-lib" }
sqlinference.workspace = true
sqruff-lib-core.workspace = true
sqruff-lib-dialects.workspace = true

prost = { default-features = false, version = "0.13" }
rust-embed = "8"
csv = "1"
petgraph = { version = "0.6", default-features = false }
Expand Down
21 changes: 4 additions & 17 deletions rust/core/src/database_bigquery.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
use sqruff::core::{
config::{FluffConfig, Value},
parser::parser::Parser,
};

use crate::databases::{
base_for_seeds_create_table_specifying_text_type, DatabaseQueryGenerator, SnapshotGenerator,
};
use sqruff_lib_core::dialects::base::Dialect;
use sqruff_lib_dialects::bigquery;

#[derive(Debug, Clone)]
pub struct DatabaseQueryGeneratorBigQuery {
project_id: String,
dataset_id: String,
config: FluffConfig,
}

impl DatabaseQueryGeneratorBigQuery {
pub fn new(project_id: String, dataset_id: String) -> DatabaseQueryGeneratorBigQuery {
DatabaseQueryGeneratorBigQuery {
project_id,
dataset_id,
config: FluffConfig::new(
[(
"core".into(),
Value::Map([("dialect".into(), Value::String("bigquery".into()))].into()),
)]
.into(),
None,
None,
),
}
}
}
Expand Down Expand Up @@ -78,8 +65,8 @@ impl DatabaseQueryGenerator for DatabaseQueryGeneratorBigQuery {
)]
}

fn get_dialect(&self) -> Parser {
Parser::new(&self.config)
fn get_dialect(&self) -> Dialect {
bigquery::dialect()
}

fn database_name_wrapper(&self, name: &str) -> String {
Expand Down
Loading
Loading