diff --git a/Cargo.lock b/Cargo.lock index c6784e33..01b472ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1266,7 +1266,7 @@ dependencies = [ [[package]] name = "ndc-sqlserver" -version = "0.2.2" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "ndc-sqlserver-cli" -version = "0.2.2" +version = "1.0.0" dependencies = [ "anyhow", "clap", @@ -1314,7 +1314,7 @@ dependencies = [ [[package]] name = "ndc-sqlserver-configuration" -version = "0.2.2" +version = "1.0.0" dependencies = [ "bb8", "bb8-tiberius", @@ -1713,7 +1713,7 @@ checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] name = "query-engine-execution" -version = "0.2.2" +version = "1.0.0" dependencies = [ "bb8", "bb8-tiberius", @@ -1733,7 +1733,7 @@ dependencies = [ [[package]] name = "query-engine-metadata" -version = "0.2.2" +version = "1.0.0" dependencies = [ "ndc-models", "schemars", @@ -1743,14 +1743,14 @@ dependencies = [ [[package]] name = "query-engine-metrics" -version = "0.2.2" +version = "1.0.0" dependencies = [ "prometheus", ] [[package]] name = "query-engine-sql" -version = "0.2.2" +version = "1.0.0" dependencies = [ "ndc-models", "serde_json", @@ -1758,7 +1758,7 @@ dependencies = [ [[package]] name = "query-engine-translation" -version = "0.2.2" +version = "1.0.0" dependencies = [ "indexmap 2.2.6", "insta", diff --git a/Cargo.toml b/Cargo.toml index 9d9e5382..45ea79f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" -package.version = "0.2.2" +package.version = "1.0.0" package.edition = "2021" members = [ diff --git a/README.md b/README.md index 791e90b7..06a6328a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![Docs](https://img.shields.io/badge/docs-v3.x-brightgreen.svg?style=flat)](https://hasura.io/docs/3.0) [![ndc-hub](https://img.shields.io/badge/ndc--hub-sqlserver-blue.svg?style=flat)](https://hasura.io/connectors/sqlserver) [![License](https://img.shields.io/badge/license-Apache--2.0-purple.svg?style=flat)](LICENSE.txt) -[![Status](https://img.shields.io/badge/status-alpha-yellow.svg?style=flat)](./readme.md) With this connector, Hasura allows you to instantly create a real-time GraphQL API on top of your data models in Microsoft SQL Server. This connector supports SQL Server's functionalities listed in the table below, allowing for diff --git a/changelog.md b/changelog.md index 128da7a8..c0e44326 100644 --- a/changelog.md +++ b/changelog.md @@ -8,20 +8,24 @@ ### Fixed +## [v1.0.0] + +### Fixed + +- Added CA certs to container for TLS + ## [v0.2.2] ### Changed - ndc-spec version to v1.6.0 - ## [v0.2.1] ### Added - Add subcommand `stored-procedures` to the `update` command to introspect stored procedures. - ## [v0.2.0] ### Added diff --git a/crates/ndc-sqlserver/src/schema.rs b/crates/ndc-sqlserver/src/schema.rs index a322a029..8d8ecab7 100644 --- a/crates/ndc-sqlserver/src/schema.rs +++ b/crates/ndc-sqlserver/src/schema.rs @@ -165,7 +165,6 @@ fn make_procedure_type( } /// Gets the schema of the native mutations. - /// Each native mutation creates two objects: /// 1. Object with name `{native_mutation_name}_response`, this object /// will contain two fields: diff --git a/crates/query-engine/execution/src/helpers.rs b/crates/query-engine/execution/src/helpers.rs index e41ba34d..9cc945ee 100644 --- a/crates/query-engine/execution/src/helpers.rs +++ b/crates/query-engine/execution/src/helpers.rs @@ -15,7 +15,6 @@ pub(crate) async fn execute_statement( /// Match on the result and execute a rollback statement against the database if we run into an /// error. - pub async fn rollback_on_exception( result: Result, connection: &mut bb8::PooledConnection<'_, bb8_tiberius::ConnectionManager>, diff --git a/crates/query-engine/metadata/src/metadata/native_queries.rs b/crates/query-engine/metadata/src/metadata/native_queries.rs index 15223bb0..43b77569 100644 --- a/crates/query-engine/metadata/src/metadata/native_queries.rs +++ b/crates/query-engine/metadata/src/metadata/native_queries.rs @@ -84,7 +84,7 @@ impl Serialize for NativeQuerySql { struct NQVisitor; -impl<'de> serde::de::Visitor<'de> for NQVisitor { +impl serde::de::Visitor<'_> for NQVisitor { type Value = NativeQuerySql; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/crates/query-engine/sql/src/sql/convert.rs b/crates/query-engine/sql/src/sql/convert.rs index 16d8d40e..606d2989 100644 --- a/crates/query-engine/sql/src/sql/convert.rs +++ b/crates/query-engine/sql/src/sql/convert.rs @@ -216,9 +216,8 @@ impl Select { sql.append_syntax(" "); - match &self.from { - Some(from) => from.to_sql(sql), - None => (), + if let Some(from) = &self.from { + from.to_sql(sql) } for join in self.joins.iter() { @@ -229,9 +228,8 @@ impl Select { self.order_by.to_sql(sql); - match &self.limit { - Some(limit) => limit.to_sql(sql), - None => (), + if let Some(limit) = &self.limit { + limit.to_sql(sql) } self.for_json.to_sql(sql); diff --git a/crates/query-engine/translation/src/translation/helpers.rs b/crates/query-engine/translation/src/translation/helpers.rs index b37678af..8c047ebb 100644 --- a/crates/query-engine/translation/src/translation/helpers.rs +++ b/crates/query-engine/translation/src/translation/helpers.rs @@ -188,7 +188,7 @@ impl<'a> Env<'a> { pub fn new( metadata: &'a metadata::Metadata, relationships: BTreeMap, - ) -> Env { + ) -> Env<'a> { Env { metadata, relationships, diff --git a/crates/query-engine/translation/src/translation/query/relationships.rs b/crates/query-engine/translation/src/translation/query/relationships.rs index 49b22492..ad0f059f 100644 --- a/crates/query-engine/translation/src/translation/query/relationships.rs +++ b/crates/query-engine/translation/src/translation/query/relationships.rs @@ -11,7 +11,6 @@ use query_engine_sql::sql; pub struct JoinFieldInfo { pub table_alias: sql::ast::TableAlias, - pub column_alias: sql::ast::ColumnAlias, pub relationship_name: String, pub arguments: BTreeMap, pub query: models::Query, diff --git a/crates/query-engine/translation/src/translation/query/root.rs b/crates/query-engine/translation/src/translation/query/root.rs index db4546d2..5646483a 100644 --- a/crates/query-engine/translation/src/translation/query/root.rs +++ b/crates/query-engine/translation/src/translation/query/root.rs @@ -208,7 +208,6 @@ pub fn translate_rows_query( }; join_fields.push(relationships::JoinFieldInfo { table_alias, - column_alias: column_alias.clone(), relationship_name: relationship.to_string(), arguments, query: *query, @@ -319,8 +318,12 @@ fn translate_query_part( relationships::translate_joins(env, state, &root_and_current_tables, join_fields)?; // translate order_by - let (order_by, order_by_joins) = - sorting::translate_order_by(env, state, &root_and_current_tables, &query.order_by)?; + let (order_by, order_by_joins) = sorting::translate_order_by( + env, + state, + &root_and_current_tables, + query.order_by.as_ref(), + )?; relationship_joins.extend(order_by_joins); // translate where diff --git a/crates/query-engine/translation/src/translation/query/sorting.rs b/crates/query-engine/translation/src/translation/query/sorting.rs index 9fb3cce9..70827527 100644 --- a/crates/query-engine/translation/src/translation/query/sorting.rs +++ b/crates/query-engine/translation/src/translation/query/sorting.rs @@ -75,7 +75,7 @@ pub fn translate_order_by( env: &Env, state: &mut State, root_and_current_tables: &RootAndCurrentTables, - order_by: &Option, + order_by: Option<&models::OrderBy>, ) -> Result<(sql::ast::OrderBy, Vec), Error> { let mut joins: Vec = vec![]; @@ -214,7 +214,7 @@ fn translate_order_by_star_count_aggregate( state, root_and_current_tables, relationship, - &path_element.predicate, + path_element.predicate.as_deref(), select_cols, (table, from_clause), )?; @@ -337,7 +337,7 @@ fn translate_order_by_target_for_column( root_and_current_tables, column_name, path, - &function, + function.as_ref(), &mut joins, (last_table, (index, path_element)), ) @@ -426,7 +426,7 @@ fn process_path_element_for_order_by_target_for_column( root_and_current_tables: &RootAndCurrentTables, target_column_name: &str, path: &[models::PathElement], - aggregate_function_for_arrays: &Option, + aggregate_function_for_arrays: Option<&models::AggregateFunctionName>, // to get the information about this path element we need to select from the relevant table // and join with the previous table. We add a new join to this list of joins. joins: &mut Vec, @@ -510,7 +510,7 @@ fn process_path_element_for_order_by_target_for_column( current_table: last_table, }, relationship, - &path_element.predicate, + path_element.predicate.as_deref(), sql::ast::SelectList::SelectList(select_cols), (table.clone(), from_clause), )?; @@ -559,7 +559,7 @@ fn select_for_path_element( state: &mut State, root_and_current_tables: &RootAndCurrentTables, relationship: &models::Relationship, - predicate: &Option>, + predicate: Option<&models::Expression>, select_list: sql::ast::SelectList, (join_table, from_clause): (TableNameAndReference, sql::ast::From), ) -> Result { diff --git a/flake.lock b/flake.lock index 9f801451..52ebdd83 100644 --- a/flake.lock +++ b/flake.lock @@ -63,19 +63,16 @@ }, "rust-overlay": { "inputs": { - "flake-utils": [ - "flake-utils" - ], "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1714097613, - "narHash": "sha256-044xbpBszupqN3nl/CGOCJtTQ4O6Aca81mJpX45i8/I=", + "lastModified": 1733452419, + "narHash": "sha256-eh2i2GtqdWVOP7yjiWtB8FMUWktCZ4vjo81n6g5mSiE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "2a42c742ab04b61d9b2f1edf392842cf9f27ebfd", + "rev": "020701e6057992329a7cfafc6e3c5d5658bbcf79", "type": "github" }, "original": { diff --git a/nix/docker.nix b/nix/docker.nix index c7e388c5..981de675 100644 --- a/nix/docker.nix +++ b/nix/docker.nix @@ -3,6 +3,7 @@ , lib , package , image-name +, pkgs , architecture ? null , tag ? null # defaults to the output hash , extraConfig ? { } # see config options at: https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions @@ -13,7 +14,7 @@ let args = { name = image-name; created = "now"; - contents = [ package ]; + contents = [ package pkgs.cacert ]; config = { Entrypoint = [ "/bin/${package.pname}" @@ -44,4 +45,4 @@ let inherit architecture; }; in -dockerTools.buildLayeredImage args \ No newline at end of file +dockerTools.buildLayeredImage args diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7abec8ad..335f6d6a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,7 @@ [toolchain] -channel = "1.77.2" -profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html -components = ["rust-analyzer", "rust-src"] # see https://rust-lang.github.io/rustup/concepts/components.html +channel = "1.83.0" +profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html +components = [ + "rust-analyzer", + "rust-src", +] # see https://rust-lang.github.io/rustup/concepts/components.html