From 27ece3df93f54a318bffac665b5c1ff0e33e5882 Mon Sep 17 00:00:00 2001 From: Benoit Ranque Date: Tue, 29 Oct 2024 15:29:53 -0400 Subject: [PATCH 1/3] use ndc-sdk for printSchemaAndCapabilities --- Cargo.lock | 62 ++++++++++----- Cargo.toml | 6 ++ crates/common/src/config.rs | 6 +- crates/ndc-clickhouse-cli/Cargo.toml | 4 +- crates/ndc-clickhouse-cli/src/main.rs | 75 +++++++++---------- crates/ndc-clickhouse-core/Cargo.toml | 28 +++++++ .../src/connector.rs | 4 +- .../src/connector/handler.rs | 0 .../src/connector/handler/explain.rs | 6 +- .../src/connector/handler/query.rs | 3 +- .../src/connector/setup.rs | 4 +- .../src/connector/state.rs | 0 .../src/lib.rs | 0 .../src/sql.rs | 0 .../src/sql/ast.rs | 0 .../src/sql/ast/format.rs | 0 .../src/sql/query_builder.rs | 4 +- .../binary_comparison_expression.rs | 0 .../sql/query_builder/collection_context.rs | 2 +- .../sql/query_builder/comparison_column.rs | 0 .../src/sql/query_builder/error.rs | 10 +-- .../sql/query_builder/function_expression.rs | 0 .../src/sql/query_builder/parameter.rs | 0 .../src/sql/query_builder/typecasting.rs | 4 +- .../tests/query_builder.rs | 6 +- ...simple_queries_01_select_rows.request.json | 0 ...ple_queries_02_with_predicate.request.json | 0 ...e_queries_03_larger_predicate.request.json | 0 .../01_simple_queries_04_limit.request.json | 0 .../01_simple_queries_05_offset.request.json | 0 ...imple_queries_06_limit_offset.request.json | 0 ...01_simple_queries_07_order_by.request.json | 0 ...edicate_limit_offset_order_by.request.json | 0 ...nships_01_object_relationship.request.json | 0 ...onships_02_array_relationship.request.json | 0 ...tionships_03_parent_predicate.request.json | 0 ...ationships_04_child_predicate.request.json | 0 ...rse_relationship_in_predicate.request.json | 0 ...erse_relationship_in_order_by.request.json | 0 ...ggregate_across_relationships.request.json | 0 ...variables_01_simple_predicate.request.json | 0 ...iables_02_empty_variable_sets.request.json | 0 .../03_variables_03_single_set.request.json | 0 .../chinook/_config/configuration.json | 0 .../01_bind_complex_parameters.request.json | 0 ...01_complex_parameters_01_bind.request.json | 0 ...mplex_parameters_02_variables.request.json | 0 ...r_01_generate_column_accessor.request.json | 0 ...essor_02_skip_if_not_required.request.json | 0 ...relationships_on_nested_field.request.json | 0 ...onships_on_array_nested_field.request.json | 0 ...n_accessor_05_complex_example.request.json | 0 ...6_no_useless_nested_accessors.request.json | 0 ...ables_with_complex_parameters.request.json | 0 .../_config/configuration.json | 0 .../query_builder/configuration.schema.json | 0 .../tests/query_builder/request.schema.json | 0 .../star_schema/01_native_query.request.json | 0 ...2_native_query_with_predicate.request.json | 0 .../star_schema/_config/configuration.json | 0 .../star_schema/_config/queries/q1.1.sql | 0 .../star_schema/_config/queries/q1.2.sql | 0 .../star_schema/_config/queries/q1.3.sql | 0 .../star_schema/_config/queries/q2.1.sql | 0 .../star_schema/_config/queries/q2.2.sql | 0 .../star_schema/_config/queries/q2.3.sql | 0 .../star_schema/_config/queries/q3.1.sql | 0 .../star_schema/_config/queries/q3.2.sql | 0 .../star_schema/_config/queries/q3.3.sql | 0 .../star_schema/_config/queries/q3.4.sql | 0 .../star_schema/_config/queries/q4.1.sql | 0 .../star_schema/_config/queries/q4.2.sql | 0 .../star_schema/_config/queries/q4.3.sql | 0 ...e_queries_01_select_rows.request.json.snap | 0 ...ueries_02_with_predicate.request.json.snap | 0 ...ries_03_larger_predicate.request.json.snap | 0 ..._simple_queries_04_limit.request.json.snap | 0 ...simple_queries_05_offset.request.json.snap | 0 ..._queries_06_limit_offset.request.json.snap | 0 ...mple_queries_07_order_by.request.json.snap | 0 ...te_limit_offset_order_by.request.json.snap | 0 ...s_01_object_relationship.request.json.snap | 0 ...ps_02_array_relationship.request.json.snap | 0 ...hips_03_parent_predicate.request.json.snap | 0 ...ships_04_child_predicate.request.json.snap | 0 ...elationship_in_predicate.request.json.snap | 0 ...relationship_in_order_by.request.json.snap | 0 ...ate_across_relationships.request.json.snap | 0 ...bles_01_simple_predicate.request.json.snap | 0 ...s_02_empty_variable_sets.request.json.snap | 0 ..._variables_03_single_set.request.json.snap | 0 ...ueries_02_with_predicate.request.json.snap | 0 ...ries_03_larger_predicate.request.json.snap | 0 ...te_limit_offset_order_by.request.json.snap | 0 ...hips_03_parent_predicate.request.json.snap | 0 ...ships_04_child_predicate.request.json.snap | 0 ...elationship_in_predicate.request.json.snap | 0 ...bles_01_simple_predicate.request.json.snap | 0 ...s_02_empty_variable_sets.request.json.snap | 0 ..._variables_03_single_set.request.json.snap | 0 ...ueries_02_with_predicate.request.json.snap | 0 ...ries_03_larger_predicate.request.json.snap | 0 ...te_limit_offset_order_by.request.json.snap | 0 ...hips_03_parent_predicate.request.json.snap | 0 ...ships_04_child_predicate.request.json.snap | 0 ...elationship_in_predicate.request.json.snap | 0 ...bles_01_simple_predicate.request.json.snap | 0 ...s_02_empty_variable_sets.request.json.snap | 0 ..._variables_03_single_set.request.json.snap | 0 ...uery_builder__chinook Schema Response.snap | 0 ...ps_on_array_nested_field.request.json.snap | 0 ..._bind_complex_parameters.request.json.snap | 0 ...mplex_parameters_01_bind.request.json.snap | 0 ..._parameters_02_variables.request.json.snap | 0 ...generate_column_accessor.request.json.snap | 0 ..._02_skip_if_not_required.request.json.snap | 0 ...ionships_on_nested_field.request.json.snap | 0 ...essor_05_complex_example.request.json.snap | 0 ...useless_nested_accessors.request.json.snap | 0 ..._with_complex_parameters.request.json.snap | 0 ..._bind_complex_parameters.request.json.snap | 0 ...mplex_parameters_01_bind.request.json.snap | 0 ..._parameters_02_variables.request.json.snap | 0 ..._with_complex_parameters.request.json.snap | 0 ..._bind_complex_parameters.request.json.snap | 0 ...mplex_parameters_01_bind.request.json.snap | 0 ..._parameters_02_variables.request.json.snap | 0 ..._with_complex_parameters.request.json.snap | 0 ...lder__complex_columns Schema Response.snap | 0 ...ined SQL@01_native_query.request.json.snap | 0 ...ive_query_with_predicate.request.json.snap | 0 ...ive_query_with_predicate.request.json.snap | 0 ...ive_query_with_predicate.request.json.snap | 0 ..._builder__star_schema Schema Response.snap | 0 crates/ndc-clickhouse/Cargo.toml | 24 +----- crates/ndc-clickhouse/src/main.rs | 2 +- 136 files changed, 145 insertions(+), 105 deletions(-) create mode 100644 crates/ndc-clickhouse-core/Cargo.toml rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/connector.rs (97%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/connector/handler.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/connector/handler/explain.rs (96%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/connector/handler/query.rs (96%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/connector/setup.rs (91%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/connector/state.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/lib.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/ast.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/ast/format.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder.rs (99%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/binary_comparison_expression.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/collection_context.rs (96%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/comparison_column.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/error.rs (96%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/function_expression.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/parameter.rs (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/src/sql/query_builder/typecasting.rs (99%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder.rs (97%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_01_select_rows.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_02_with_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_03_larger_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_04_limit.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_05_offset.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_06_limit_offset.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_07_order_by.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/01_simple_queries_08_predicate_limit_offset_order_by.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_01_object_relationship.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_02_array_relationship.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_03_parent_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_04_child_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_05_traverse_relationship_in_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_06_traverse_relationship_in_order_by.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/02_relationships_07_order_by_aggregate_across_relationships.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/03_variables_01_simple_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/03_variables_02_empty_variable_sets.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/03_variables_03_single_set.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/chinook/_config/configuration.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/01_bind_complex_parameters.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/01_complex_parameters_01_bind.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/01_complex_parameters_02_variables.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_column_accessor_01_generate_column_accessor.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_column_accessor_02_skip_if_not_required.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_column_accessor_03_support_relationships_on_nested_field.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_column_accessor_05_complex_example.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_column_accessor_06_no_useless_nested_accessors.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/02_variables_with_complex_parameters.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/complex_columns/_config/configuration.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/configuration.schema.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/request.schema.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/01_native_query.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/02_native_query_with_predicate.request.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/configuration.json (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q1.1.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q1.2.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q1.3.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q2.1.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q2.2.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q2.3.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q3.1.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q3.2.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q3.3.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q3.4.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q4.1.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q4.2.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/query_builder/star_schema/_config/queries/q4.3.sql (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_01_select_rows.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_02_with_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_03_larger_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_04_limit.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_05_offset.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_06_limit_offset.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_07_order_by.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_01_object_relationship.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_02_array_relationship.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_03_parent_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_04_child_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_06_traverse_relationship_in_order_by.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_07_order_by_aggregate_across_relationships.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_01_simple_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_02_empty_variable_sets.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_03_single_set.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_02_with_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_03_larger_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_03_parent_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_04_child_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_01_simple_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_02_empty_variable_sets.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_03_single_set.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_02_with_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_03_larger_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@02_relationships_03_parent_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@02_relationships_04_child_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@02_relationships_05_traverse_relationship_in_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@03_variables_01_simple_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@03_variables_02_empty_variable_sets.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Parameters@03_variables_03_single_set.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__chinook Schema Response.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Expected Error@02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@01_bind_complex_parameters.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_01_bind.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_02_variables.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_01_generate_column_accessor.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_02_skip_if_not_required.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_03_support_relationships_on_nested_field.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_05_complex_example.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_06_no_useless_nested_accessors.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Inlined SQL@02_variables_with_complex_parameters.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_bind_complex_parameters.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_01_bind.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_02_variables.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameterized SQL@02_variables_with_complex_parameters.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameters@01_bind_complex_parameters.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_01_bind.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_02_variables.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Parameters@02_variables_with_complex_parameters.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__complex_columns Schema Response.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__star_schema Inlined SQL@01_native_query.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__star_schema Inlined SQL@02_native_query_with_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__star_schema Parameterized SQL@02_native_query_with_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__star_schema Parameters@02_native_query_with_predicate.request.json.snap (100%) rename crates/{ndc-clickhouse => ndc-clickhouse-core}/tests/snapshots/query_builder__star_schema Schema Response.snap (100%) diff --git a/Cargo.lock b/Cargo.lock index 17b7f48..5a5e2d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1146,38 +1146,48 @@ dependencies = [ name = "ndc-clickhouse" version = "1.0.5" dependencies = [ - "async-trait", - "bytes", + "ndc-clickhouse-core", + "ndc-sdk", + "tokio", +] + +[[package]] +name = "ndc-clickhouse-cli" +version = "1.0.5" +dependencies = [ + "clap", "common", - "http 0.2.12", - "indexmap 2.5.0", "insta", - "ndc-sdk", - "prometheus", + "ndc-clickhouse-core", + "ndc-models", + "ndc-sdk-core", "reqwest 0.12.7", "schemars", "serde", "serde_json", - "sqlformat", - "strum", - "thiserror", "tokio", - "tracing", ] [[package]] -name = "ndc-clickhouse-cli" +name = "ndc-clickhouse-core" version = "1.0.5" dependencies = [ - "clap", + "async-trait", "common", + "http 0.2.12", + "indexmap 2.5.0", "insta", "ndc-models", + "ndc-sdk-core", + "prometheus", "reqwest 0.12.7", "schemars", "serde", "serde_json", + "sqlformat", + "thiserror", "tokio", + "tracing", ] [[package]] @@ -1196,17 +1206,16 @@ dependencies = [ [[package]] name = "ndc-sdk" -version = "0.4.0" -source = "git+https://github.com/hasura/ndc-sdk-rs?tag=v0.4.0#665509f7d3b47ce4f014fc23f817a3599ba13933" +version = "0.5.0" +source = "git+https://github.com/hasura/ndc-sdk-rs?tag=v0.5.0#15840777b3700112a508bb116f1131804e800c13" dependencies = [ "async-trait", "axum", "axum-extra", - "bytes", "clap", "http 0.2.12", - "mime", "ndc-models", + "ndc-sdk-core", "ndc-test", "opentelemetry", "opentelemetry-http", @@ -1216,7 +1225,6 @@ dependencies = [ "opentelemetry_sdk", "prometheus", "reqwest 0.11.27", - "serde", "serde_json", "thiserror", "tokio", @@ -1227,6 +1235,26 @@ dependencies = [ "url", ] +[[package]] +name = "ndc-sdk-core" +version = "0.5.0" +source = "git+https://github.com/hasura/ndc-sdk-rs?tag=v0.5.0#15840777b3700112a508bb116f1131804e800c13" +dependencies = [ + "async-trait", + "axum", + "bytes", + "http 0.2.12", + "mime", + "ndc-models", + "ndc-test", + "prometheus", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "ndc-test" version = "0.1.6" diff --git a/Cargo.toml b/Cargo.toml index 258e3f9..7ef375f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "crates/ndc-clickhouse", "crates/ndc-clickhouse-cli", + "crates/ndc-clickhouse-core", "crates/common", ] resolver = "2" @@ -9,6 +10,11 @@ resolver = "2" package.version = "1.0.5" package.edition = "2021" +[workspace.dependencies] +ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.6" } +ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.5.0", package = "ndc-sdk" } +ndc-sdk-core = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.5.0", package = "ndc-sdk-core" } + # insta performs better in release mode [profile.dev.package] insta.opt-level = 3 diff --git a/crates/common/src/config.rs b/crates/common/src/config.rs index ca21be3..b2cd417 100644 --- a/crates/common/src/config.rs +++ b/crates/common/src/config.rs @@ -143,10 +143,10 @@ pub fn get_connection_configuration( } pub async fn read_server_config( - configuration_dir: impl AsRef + Send, + configuration_dir: &Path, environment: &ConfigurationEnvironment, ) -> Result { - let file_path = configuration_dir.as_ref().join(CONFIG_FILE_NAME); + let file_path = configuration_dir.join(CONFIG_FILE_NAME); let connection = get_connection_configuration(environment)?; @@ -259,7 +259,7 @@ pub async fn read_server_config( let mut queries = BTreeMap::new(); for (query_alias, query_config) in config.queries.clone() { - let query_file_path = configuration_dir.as_ref().join(&query_config.file); + let query_file_path = configuration_dir.join(&query_config.file); let file_content = fs::read_to_string(&query_file_path) .await diff --git a/crates/ndc-clickhouse-cli/Cargo.toml b/crates/ndc-clickhouse-cli/Cargo.toml index e5ad093..25c5424 100644 --- a/crates/ndc-clickhouse-cli/Cargo.toml +++ b/crates/ndc-clickhouse-cli/Cargo.toml @@ -6,7 +6,9 @@ edition.workspace = true [dependencies] clap = { version = "4.5.3", features = ["derive", "env"] } common = { path = "../common" } -ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.6" } +ndc-models = { workspace = true } +ndc-sdk-core = { workspace = true } +ndc-clickhouse-core = { path = "../ndc-clickhouse-core" } reqwest = { version = "0.12.3", features = [ "json", "rustls-tls", diff --git a/crates/ndc-clickhouse-cli/src/main.rs b/crates/ndc-clickhouse-cli/src/main.rs index 09694df..0245510 100644 --- a/crates/ndc-clickhouse-cli/src/main.rs +++ b/crates/ndc-clickhouse-cli/src/main.rs @@ -1,29 +1,28 @@ -use std::{ - collections::{BTreeMap, HashMap}, - env, - error::Error, - path::{Path, PathBuf}, - str::FromStr, -}; - use clap::{Parser, Subcommand, ValueEnum}; use common::{ - capabilities::capabilities_response, clickhouse_parser::{ datatype::ClickHouseDataType, parameterized_query::{Parameter, ParameterizedQuery, ParameterizedQueryElement}, }, - config::{read_server_config, ConfigurationEnvironment, ConnectionConfig}, + config::ConnectionConfig, config_file::{ ParameterizedQueryConfigFile, PrimaryKey, ReturnType, ServerConfigFile, TableConfigFile, CONFIG_FILE_NAME, CONFIG_SCHEMA_FILE_NAME, }, - schema::schema_response, }; use database_introspection::{introspect_database, TableInfo}; -use ndc_models::{CapabilitiesResponse, CollectionName, FieldName, SchemaResponse}; +use ndc_clickhouse_core::connector::setup::ClickhouseConnectorSetup; +use ndc_models::{CollectionName, FieldName}; +use ndc_sdk_core::schema::print_schema_and_capabilities; use schemars::schema_for; -use serde::Serialize; +use std::{ + collections::{BTreeMap, HashMap}, + env, + error::Error, + io, + path::{Path, PathBuf}, + str::FromStr, +}; use tokio::fs; mod database_introspection; @@ -85,7 +84,18 @@ enum Command { }, Validate {}, Watch {}, - PrintSchemaAndCapabilities {}, + PrintSchemaAndCapabilities { + #[arg(long = "clickhouse-url", value_name = "URL", env = "CLICKHOUSE_URL")] + url: String, + #[arg(long = "clickhouse-username", value_name = "USERNAME", env = "CLICKHOUSE_USERNAME", default_value_t = String::from("default"))] + username: String, + #[arg( + long = "clickhouse-password", + value_name = "PASSWORD", + env = "CLICKHOUSE_PASSWORD" + )] + password: String, + }, UpgradeConfiguration {}, } @@ -100,12 +110,6 @@ enum LogLevel { Trace, } -#[derive(Serialize)] -struct SchemaAndCapabilities { - schema: SchemaResponse, - capabilities: CapabilitiesResponse, -} - #[tokio::main] async fn main() -> Result<(), Box> { let args = CliArgs::parse(); @@ -155,28 +159,21 @@ async fn main() -> Result<(), Box> { Command::Watch {} => { todo!("implement watch command") } - Command::PrintSchemaAndCapabilities {} => { - // set mock values for required env vars, we won't be reading these anyways + Command::PrintSchemaAndCapabilities { + url, + username, + password, + } => { + // use simulated environment so env vars can be read from command line arguments let env = HashMap::from_iter(vec![ - ("CLICKHOUSE_URL".to_owned(), "".to_owned()), - ("CLICKHOUSE_USERNAME".to_owned(), "".to_owned()), - ("CLICKHOUSE_PASSWORD".to_owned(), "".to_owned()), + ("CLICKHOUSE_URL".to_owned(), url), + ("CLICKHOUSE_USERNAME".to_owned(), username), + ("CLICKHOUSE_PASSWORD".to_owned(), password), ]); - let configuration = read_server_config( - context_path, - &ConfigurationEnvironment::from_simulated_environment(env), - ) - .await?; + let setup = ClickhouseConnectorSetup::new_from_env(env); - let schema_and_capabilities = SchemaAndCapabilities { - schema: schema_response(&configuration), - capabilities: capabilities_response(), - }; - println!( - "{}", - serde_json::to_string(&schema_and_capabilities) - .expect("Schema and capabilities should serialize to JSON") - ) + let mut stdout = io::stdout().lock(); + print_schema_and_capabilities(setup, &context_path, &mut stdout).await?; } Command::UpgradeConfiguration {} => { println!("Upgrade Configuration command is currently a NOOP") diff --git a/crates/ndc-clickhouse-core/Cargo.toml b/crates/ndc-clickhouse-core/Cargo.toml new file mode 100644 index 0000000..5593c90 --- /dev/null +++ b/crates/ndc-clickhouse-core/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "ndc-clickhouse-core" +version.workspace = true +edition.workspace = true + +[dependencies] +async-trait = "0.1.78" +common = { path = "../common" } +http = "0.2" +indexmap = "2.1.0" +ndc-models = { workspace = true } +ndc-sdk-core = { workspace = true } +prometheus = "0.13.3" +reqwest = { version = "0.12.3", features = [ + "json", + "rustls-tls", +], default-features = false } +schemars = "0.8.16" +serde = { version = "1.0.197", features = ["derive"] } +serde_json = "1.0.114" +sqlformat = "0.2.3" +thiserror = "1.0.64" +tokio = "1.36.0" +tracing = "0.1.40" + +[dev-dependencies] +insta = { version = "1.40.0", features = ["yaml", "glob", "json"] } +schemars = "0.8.16" diff --git a/crates/ndc-clickhouse/src/connector.rs b/crates/ndc-clickhouse-core/src/connector.rs similarity index 97% rename from crates/ndc-clickhouse/src/connector.rs rename to crates/ndc-clickhouse-core/src/connector.rs index 0b5fcdb..4efed05 100644 --- a/crates/ndc-clickhouse/src/connector.rs +++ b/crates/ndc-clickhouse-core/src/connector.rs @@ -6,10 +6,10 @@ use self::state::ServerState; use async_trait::async_trait; use common::{capabilities::capabilities, config::ServerConfig, schema::schema_response}; use http::StatusCode; -use ndc_sdk::{ +use ndc_models as models; +use ndc_sdk_core::{ connector::{Connector, ErrorResponse, Result}, json_response::JsonResponse, - models, }; #[derive(Debug, Clone, Default)] diff --git a/crates/ndc-clickhouse/src/connector/handler.rs b/crates/ndc-clickhouse-core/src/connector/handler.rs similarity index 100% rename from crates/ndc-clickhouse/src/connector/handler.rs rename to crates/ndc-clickhouse-core/src/connector/handler.rs diff --git a/crates/ndc-clickhouse/src/connector/handler/explain.rs b/crates/ndc-clickhouse-core/src/connector/handler/explain.rs similarity index 96% rename from crates/ndc-clickhouse/src/connector/handler/explain.rs rename to crates/ndc-clickhouse-core/src/connector/handler/explain.rs index 4abc479..c39c3e2 100644 --- a/crates/ndc-clickhouse/src/connector/handler/explain.rs +++ b/crates/ndc-clickhouse-core/src/connector/handler/explain.rs @@ -1,8 +1,8 @@ -use std::collections::BTreeMap; - use common::{client::execute_json_query, config::ServerConfig}; -use ndc_sdk::{connector::ErrorResponse, json_response::JsonResponse, models}; +use ndc_models as models; +use ndc_sdk_core::{connector::ErrorResponse, json_response::JsonResponse}; use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; use crate::{connector::state::ServerState, sql::QueryBuilder}; diff --git a/crates/ndc-clickhouse/src/connector/handler/query.rs b/crates/ndc-clickhouse-core/src/connector/handler/query.rs similarity index 96% rename from crates/ndc-clickhouse/src/connector/handler/query.rs rename to crates/ndc-clickhouse-core/src/connector/handler/query.rs index 7cdb9b1..7ea5d82 100644 --- a/crates/ndc-clickhouse/src/connector/handler/query.rs +++ b/crates/ndc-clickhouse-core/src/connector/handler/query.rs @@ -1,5 +1,6 @@ use common::{client::execute_query, config::ServerConfig}; -use ndc_sdk::{connector::ErrorResponse, json_response::JsonResponse, models}; +use ndc_models as models; +use ndc_sdk_core::{connector::ErrorResponse, json_response::JsonResponse}; use tracing::{Instrument, Level}; use crate::{connector::state::ServerState, sql::QueryBuilder}; diff --git a/crates/ndc-clickhouse/src/connector/setup.rs b/crates/ndc-clickhouse-core/src/connector/setup.rs similarity index 91% rename from crates/ndc-clickhouse/src/connector/setup.rs rename to crates/ndc-clickhouse-core/src/connector/setup.rs index aaad914..7245148 100644 --- a/crates/ndc-clickhouse/src/connector/setup.rs +++ b/crates/ndc-clickhouse-core/src/connector/setup.rs @@ -1,7 +1,7 @@ use super::{state::ServerState, ClickhouseConnector}; use async_trait::async_trait; use common::config::{read_server_config, ConfigurationEnvironment}; -use ndc_sdk::connector::{self, Connector, ConnectorSetup, ErrorResponse}; +use ndc_sdk_core::connector::{self, Connector, ConnectorSetup, ErrorResponse}; use std::{collections::HashMap, path::Path}; #[derive(Debug, Clone)] pub struct ClickhouseConnectorSetup(ConfigurationEnvironment); @@ -12,7 +12,7 @@ impl ConnectorSetup for ClickhouseConnectorSetup { async fn parse_configuration( &self, - configuration_dir: impl AsRef + Send, + configuration_dir: &Path, ) -> connector::Result<::Configuration> { // we wrap read_server_config so the ParseError is implicitly converted into an ErrorResponse read_server_config(configuration_dir, &self.0) diff --git a/crates/ndc-clickhouse/src/connector/state.rs b/crates/ndc-clickhouse-core/src/connector/state.rs similarity index 100% rename from crates/ndc-clickhouse/src/connector/state.rs rename to crates/ndc-clickhouse-core/src/connector/state.rs diff --git a/crates/ndc-clickhouse/src/lib.rs b/crates/ndc-clickhouse-core/src/lib.rs similarity index 100% rename from crates/ndc-clickhouse/src/lib.rs rename to crates/ndc-clickhouse-core/src/lib.rs diff --git a/crates/ndc-clickhouse/src/sql.rs b/crates/ndc-clickhouse-core/src/sql.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql.rs rename to crates/ndc-clickhouse-core/src/sql.rs diff --git a/crates/ndc-clickhouse/src/sql/ast.rs b/crates/ndc-clickhouse-core/src/sql/ast.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql/ast.rs rename to crates/ndc-clickhouse-core/src/sql/ast.rs diff --git a/crates/ndc-clickhouse/src/sql/ast/format.rs b/crates/ndc-clickhouse-core/src/sql/ast/format.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql/ast/format.rs rename to crates/ndc-clickhouse-core/src/sql/ast/format.rs diff --git a/crates/ndc-clickhouse/src/sql/query_builder.rs b/crates/ndc-clickhouse-core/src/sql/query_builder.rs similarity index 99% rename from crates/ndc-clickhouse/src/sql/query_builder.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder.rs index 9391b2f..30a9938 100644 --- a/crates/ndc-clickhouse/src/sql/query_builder.rs +++ b/crates/ndc-clickhouse-core/src/sql/query_builder.rs @@ -23,8 +23,8 @@ use comparison_column::ComparisonColumn; pub use error::QueryBuilderError; use function_expression::apply_function; use indexmap::IndexMap; -use ndc_sdk::models::{ - self, AggregateFunctionName, ArgumentName, CollectionName, FieldName, ObjectTypeName, +use ndc_models::{ + self as models, AggregateFunctionName, ArgumentName, CollectionName, FieldName, ObjectTypeName, RelationshipName, VariableName, }; use parameter::ParameterBuilder; diff --git a/crates/ndc-clickhouse/src/sql/query_builder/binary_comparison_expression.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/binary_comparison_expression.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql/query_builder/binary_comparison_expression.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/binary_comparison_expression.rs diff --git a/crates/ndc-clickhouse/src/sql/query_builder/collection_context.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/collection_context.rs similarity index 96% rename from crates/ndc-clickhouse/src/sql/query_builder/collection_context.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/collection_context.rs index e3b9a13..2e776b4 100644 --- a/crates/ndc-clickhouse/src/sql/query_builder/collection_context.rs +++ b/crates/ndc-clickhouse-core/src/sql/query_builder/collection_context.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; -use ndc_sdk::models::{Argument, ArgumentName, CollectionName, Relationship, RelationshipArgument}; +use ndc_models::{Argument, ArgumentName, CollectionName, Relationship, RelationshipArgument}; #[derive(Debug, Clone)] pub enum CollectionContext<'a, 'b> { diff --git a/crates/ndc-clickhouse/src/sql/query_builder/comparison_column.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/comparison_column.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql/query_builder/comparison_column.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/comparison_column.rs diff --git a/crates/ndc-clickhouse/src/sql/query_builder/error.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/error.rs similarity index 96% rename from crates/ndc-clickhouse/src/sql/query_builder/error.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/error.rs index e825d77..1a2042a 100644 --- a/crates/ndc-clickhouse/src/sql/query_builder/error.rs +++ b/crates/ndc-clickhouse-core/src/sql/query_builder/error.rs @@ -1,13 +1,11 @@ use super::typecasting::TypeStringError; use common::clickhouse_parser::{datatype::ClickHouseDataType, parameterized_query::ParameterType}; use http::StatusCode; -use ndc_sdk::{ - connector::ErrorResponse, - models::{ - AggregateFunctionName, ArgumentName, CollectionName, ComparisonOperatorName, FieldName, - ObjectTypeName, RelationshipName, - }, +use ndc_models::{ + AggregateFunctionName, ArgumentName, CollectionName, ComparisonOperatorName, FieldName, + ObjectTypeName, RelationshipName, }; +use ndc_sdk_core::connector::ErrorResponse; #[derive(Debug, PartialEq, thiserror::Error)] pub enum QueryBuilderError { diff --git a/crates/ndc-clickhouse/src/sql/query_builder/function_expression.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/function_expression.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql/query_builder/function_expression.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/function_expression.rs diff --git a/crates/ndc-clickhouse/src/sql/query_builder/parameter.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/parameter.rs similarity index 100% rename from crates/ndc-clickhouse/src/sql/query_builder/parameter.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/parameter.rs diff --git a/crates/ndc-clickhouse/src/sql/query_builder/typecasting.rs b/crates/ndc-clickhouse-core/src/sql/query_builder/typecasting.rs similarity index 99% rename from crates/ndc-clickhouse/src/sql/query_builder/typecasting.rs rename to crates/ndc-clickhouse-core/src/sql/query_builder/typecasting.rs index 87c5922..51351e5 100644 --- a/crates/ndc-clickhouse/src/sql/query_builder/typecasting.rs +++ b/crates/ndc-clickhouse-core/src/sql/query_builder/typecasting.rs @@ -7,8 +7,8 @@ use common::{ }, }; use indexmap::IndexMap; -use ndc_sdk::models::{ - self, AggregateFunctionName, CollectionName, FieldName, NestedField, ObjectTypeName, +use ndc_models::{ + self as models, AggregateFunctionName, CollectionName, FieldName, NestedField, ObjectTypeName, RelationshipName, }; use std::{collections::BTreeMap, str::FromStr}; diff --git a/crates/ndc-clickhouse/tests/query_builder.rs b/crates/ndc-clickhouse-core/tests/query_builder.rs similarity index 97% rename from crates/ndc-clickhouse/tests/query_builder.rs rename to crates/ndc-clickhouse-core/tests/query_builder.rs index 19d58c5..edc7b35 100644 --- a/crates/ndc-clickhouse/tests/query_builder.rs +++ b/crates/ndc-clickhouse-core/tests/query_builder.rs @@ -4,8 +4,8 @@ use common::{ schema::schema_response, }; use insta::{assert_snapshot, assert_yaml_snapshot, glob}; -use ndc_clickhouse::sql::QueryBuilder; -use ndc_sdk::models; +use ndc_clickhouse_core::sql::QueryBuilder; +use ndc_models as models; use schemars::schema_for; use std::{collections::HashMap, error::Error, fs, path::PathBuf}; @@ -24,7 +24,7 @@ async fn read_mock_configuration(schema_dir: &str) -> ServerConfig { ]); let config_dir = base_path().join(schema_dir).join("_config"); read_server_config( - config_dir, + config_dir.as_path(), &ConfigurationEnvironment::from_simulated_environment(env), ) .await diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_01_select_rows.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_01_select_rows.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_01_select_rows.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_01_select_rows.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_02_with_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_02_with_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_02_with_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_02_with_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_03_larger_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_03_larger_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_03_larger_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_03_larger_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_04_limit.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_04_limit.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_04_limit.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_04_limit.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_05_offset.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_05_offset.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_05_offset.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_05_offset.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_06_limit_offset.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_06_limit_offset.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_06_limit_offset.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_06_limit_offset.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_07_order_by.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_07_order_by.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_07_order_by.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_07_order_by.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_08_predicate_limit_offset_order_by.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_08_predicate_limit_offset_order_by.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/01_simple_queries_08_predicate_limit_offset_order_by.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/01_simple_queries_08_predicate_limit_offset_order_by.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_01_object_relationship.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_01_object_relationship.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_01_object_relationship.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_01_object_relationship.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_02_array_relationship.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_02_array_relationship.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_02_array_relationship.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_02_array_relationship.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_03_parent_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_03_parent_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_03_parent_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_03_parent_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_04_child_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_04_child_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_04_child_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_04_child_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_05_traverse_relationship_in_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_05_traverse_relationship_in_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_05_traverse_relationship_in_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_05_traverse_relationship_in_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_06_traverse_relationship_in_order_by.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_06_traverse_relationship_in_order_by.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_06_traverse_relationship_in_order_by.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_06_traverse_relationship_in_order_by.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_07_order_by_aggregate_across_relationships.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_07_order_by_aggregate_across_relationships.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/02_relationships_07_order_by_aggregate_across_relationships.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/02_relationships_07_order_by_aggregate_across_relationships.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/03_variables_01_simple_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/03_variables_01_simple_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/03_variables_01_simple_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/03_variables_01_simple_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/03_variables_02_empty_variable_sets.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/03_variables_02_empty_variable_sets.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/03_variables_02_empty_variable_sets.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/03_variables_02_empty_variable_sets.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/03_variables_03_single_set.request.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/03_variables_03_single_set.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/03_variables_03_single_set.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/03_variables_03_single_set.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/chinook/_config/configuration.json b/crates/ndc-clickhouse-core/tests/query_builder/chinook/_config/configuration.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/chinook/_config/configuration.json rename to crates/ndc-clickhouse-core/tests/query_builder/chinook/_config/configuration.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/01_bind_complex_parameters.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/01_bind_complex_parameters.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/01_bind_complex_parameters.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/01_bind_complex_parameters.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/01_complex_parameters_01_bind.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/01_complex_parameters_01_bind.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/01_complex_parameters_01_bind.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/01_complex_parameters_01_bind.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/01_complex_parameters_02_variables.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/01_complex_parameters_02_variables.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/01_complex_parameters_02_variables.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/01_complex_parameters_02_variables.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_01_generate_column_accessor.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_01_generate_column_accessor.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_01_generate_column_accessor.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_01_generate_column_accessor.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_02_skip_if_not_required.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_02_skip_if_not_required.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_02_skip_if_not_required.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_02_skip_if_not_required.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_03_support_relationships_on_nested_field.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_03_support_relationships_on_nested_field.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_03_support_relationships_on_nested_field.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_03_support_relationships_on_nested_field.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_05_complex_example.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_05_complex_example.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_05_complex_example.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_05_complex_example.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_06_no_useless_nested_accessors.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_06_no_useless_nested_accessors.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_column_accessor_06_no_useless_nested_accessors.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_column_accessor_06_no_useless_nested_accessors.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/02_variables_with_complex_parameters.request.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_variables_with_complex_parameters.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/02_variables_with_complex_parameters.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/02_variables_with_complex_parameters.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/complex_columns/_config/configuration.json b/crates/ndc-clickhouse-core/tests/query_builder/complex_columns/_config/configuration.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/complex_columns/_config/configuration.json rename to crates/ndc-clickhouse-core/tests/query_builder/complex_columns/_config/configuration.json diff --git a/crates/ndc-clickhouse/tests/query_builder/configuration.schema.json b/crates/ndc-clickhouse-core/tests/query_builder/configuration.schema.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/configuration.schema.json rename to crates/ndc-clickhouse-core/tests/query_builder/configuration.schema.json diff --git a/crates/ndc-clickhouse/tests/query_builder/request.schema.json b/crates/ndc-clickhouse-core/tests/query_builder/request.schema.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/request.schema.json rename to crates/ndc-clickhouse-core/tests/query_builder/request.schema.json diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/01_native_query.request.json b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/01_native_query.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/01_native_query.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/01_native_query.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/02_native_query_with_predicate.request.json b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/02_native_query_with_predicate.request.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/02_native_query_with_predicate.request.json rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/02_native_query_with_predicate.request.json diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/configuration.json b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/configuration.json similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/configuration.json rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/configuration.json diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q1.1.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q1.1.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q1.1.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q1.1.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q1.2.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q1.2.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q1.2.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q1.2.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q1.3.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q1.3.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q1.3.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q1.3.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q2.1.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q2.1.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q2.1.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q2.1.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q2.2.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q2.2.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q2.2.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q2.2.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q2.3.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q2.3.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q2.3.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q2.3.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.1.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.1.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.1.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.1.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.2.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.2.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.2.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.2.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.3.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.3.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.3.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.3.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.4.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.4.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q3.4.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q3.4.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q4.1.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q4.1.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q4.1.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q4.1.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q4.2.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q4.2.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q4.2.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q4.2.sql diff --git a/crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q4.3.sql b/crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q4.3.sql similarity index 100% rename from crates/ndc-clickhouse/tests/query_builder/star_schema/_config/queries/q4.3.sql rename to crates/ndc-clickhouse-core/tests/query_builder/star_schema/_config/queries/q4.3.sql diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_01_select_rows.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_01_select_rows.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_01_select_rows.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_01_select_rows.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_02_with_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_02_with_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_02_with_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_02_with_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_03_larger_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_03_larger_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_03_larger_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_03_larger_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_04_limit.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_04_limit.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_04_limit.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_04_limit.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_05_offset.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_05_offset.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_05_offset.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_05_offset.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_06_limit_offset.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_06_limit_offset.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_06_limit_offset.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_06_limit_offset.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_07_order_by.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_07_order_by.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_07_order_by.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_07_order_by.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_01_object_relationship.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_01_object_relationship.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_01_object_relationship.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_01_object_relationship.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_02_array_relationship.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_02_array_relationship.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_02_array_relationship.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_02_array_relationship.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_03_parent_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_03_parent_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_03_parent_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_03_parent_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_04_child_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_04_child_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_04_child_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_04_child_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_06_traverse_relationship_in_order_by.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_06_traverse_relationship_in_order_by.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_06_traverse_relationship_in_order_by.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_06_traverse_relationship_in_order_by.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_07_order_by_aggregate_across_relationships.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_07_order_by_aggregate_across_relationships.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_07_order_by_aggregate_across_relationships.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@02_relationships_07_order_by_aggregate_across_relationships.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_01_simple_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_01_simple_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_01_simple_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_01_simple_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_02_empty_variable_sets.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_02_empty_variable_sets.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_02_empty_variable_sets.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_02_empty_variable_sets.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_03_single_set.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_03_single_set.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_03_single_set.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Inlined SQL@03_variables_03_single_set.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_02_with_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_02_with_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_02_with_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_02_with_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_03_larger_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_03_larger_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_03_larger_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_03_larger_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_03_parent_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_03_parent_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_03_parent_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_03_parent_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_04_child_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_04_child_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_04_child_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_04_child_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@02_relationships_05_traverse_relationship_in_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_01_simple_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_01_simple_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_01_simple_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_01_simple_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_02_empty_variable_sets.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_02_empty_variable_sets.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_02_empty_variable_sets.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_02_empty_variable_sets.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_03_single_set.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_03_single_set.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_03_single_set.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameterized SQL@03_variables_03_single_set.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_02_with_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_02_with_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_02_with_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_02_with_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_03_larger_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_03_larger_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_03_larger_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_03_larger_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@01_simple_queries_08_predicate_limit_offset_order_by.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@02_relationships_03_parent_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@02_relationships_03_parent_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@02_relationships_03_parent_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@02_relationships_03_parent_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@02_relationships_04_child_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@02_relationships_04_child_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@02_relationships_04_child_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@02_relationships_04_child_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@02_relationships_05_traverse_relationship_in_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@02_relationships_05_traverse_relationship_in_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@02_relationships_05_traverse_relationship_in_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@02_relationships_05_traverse_relationship_in_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@03_variables_01_simple_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@03_variables_01_simple_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@03_variables_01_simple_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@03_variables_01_simple_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@03_variables_02_empty_variable_sets.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@03_variables_02_empty_variable_sets.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@03_variables_02_empty_variable_sets.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@03_variables_02_empty_variable_sets.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@03_variables_03_single_set.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@03_variables_03_single_set.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Parameters@03_variables_03_single_set.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Parameters@03_variables_03_single_set.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Schema Response.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Schema Response.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__chinook Schema Response.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__chinook Schema Response.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Expected Error@02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Expected Error@02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Expected Error@02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Expected Error@02_column_accessor_04_error_on_relationships_on_array_nested_field.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@01_bind_complex_parameters.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@01_bind_complex_parameters.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@01_bind_complex_parameters.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@01_bind_complex_parameters.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_01_bind.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_01_bind.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_01_bind.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_01_bind.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_02_variables.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_02_variables.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_02_variables.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@01_complex_parameters_02_variables.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_01_generate_column_accessor.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_01_generate_column_accessor.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_01_generate_column_accessor.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_01_generate_column_accessor.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_02_skip_if_not_required.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_02_skip_if_not_required.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_02_skip_if_not_required.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_02_skip_if_not_required.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_03_support_relationships_on_nested_field.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_03_support_relationships_on_nested_field.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_03_support_relationships_on_nested_field.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_03_support_relationships_on_nested_field.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_05_complex_example.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_05_complex_example.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_05_complex_example.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_05_complex_example.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_06_no_useless_nested_accessors.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_06_no_useless_nested_accessors.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_06_no_useless_nested_accessors.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_column_accessor_06_no_useless_nested_accessors.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_variables_with_complex_parameters.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_variables_with_complex_parameters.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Inlined SQL@02_variables_with_complex_parameters.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Inlined SQL@02_variables_with_complex_parameters.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_bind_complex_parameters.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_bind_complex_parameters.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_bind_complex_parameters.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_bind_complex_parameters.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_01_bind.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_01_bind.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_01_bind.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_01_bind.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_02_variables.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_02_variables.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_02_variables.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@01_complex_parameters_02_variables.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@02_variables_with_complex_parameters.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@02_variables_with_complex_parameters.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameterized SQL@02_variables_with_complex_parameters.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameterized SQL@02_variables_with_complex_parameters.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@01_bind_complex_parameters.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@01_bind_complex_parameters.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@01_bind_complex_parameters.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@01_bind_complex_parameters.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_01_bind.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_01_bind.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_01_bind.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_01_bind.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_02_variables.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_02_variables.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_02_variables.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@01_complex_parameters_02_variables.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@02_variables_with_complex_parameters.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@02_variables_with_complex_parameters.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Parameters@02_variables_with_complex_parameters.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Parameters@02_variables_with_complex_parameters.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Schema Response.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Schema Response.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__complex_columns Schema Response.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__complex_columns Schema Response.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Inlined SQL@01_native_query.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Inlined SQL@01_native_query.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Inlined SQL@01_native_query.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Inlined SQL@01_native_query.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Inlined SQL@02_native_query_with_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Inlined SQL@02_native_query_with_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Inlined SQL@02_native_query_with_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Inlined SQL@02_native_query_with_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Parameterized SQL@02_native_query_with_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Parameterized SQL@02_native_query_with_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Parameterized SQL@02_native_query_with_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Parameterized SQL@02_native_query_with_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Parameters@02_native_query_with_predicate.request.json.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Parameters@02_native_query_with_predicate.request.json.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Parameters@02_native_query_with_predicate.request.json.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Parameters@02_native_query_with_predicate.request.json.snap diff --git a/crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Schema Response.snap b/crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Schema Response.snap similarity index 100% rename from crates/ndc-clickhouse/tests/snapshots/query_builder__star_schema Schema Response.snap rename to crates/ndc-clickhouse-core/tests/snapshots/query_builder__star_schema Schema Response.snap diff --git a/crates/ndc-clickhouse/Cargo.toml b/crates/ndc-clickhouse/Cargo.toml index 000a526..1174ffd 100644 --- a/crates/ndc-clickhouse/Cargo.toml +++ b/crates/ndc-clickhouse/Cargo.toml @@ -4,26 +4,6 @@ version.workspace = true edition.workspace = true [dependencies] -async-trait = "0.1.78" -bytes = "1.6.0" -common = { path = "../common" } -http = "0.2" -indexmap = "2.1.0" -ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.4.0", package = "ndc-sdk" } -prometheus = "0.13.3" -reqwest = { version = "0.12.3", features = [ - "json", - "rustls-tls", -], default-features = false } -schemars = "0.8.16" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.114" -sqlformat = "0.2.3" -strum = { version = "0.26.3", features = ["derive"] } -thiserror = "1.0.64" +ndc-sdk = { workspace = true } +ndc-clickhouse-core = { path = "../ndc-clickhouse-core" } tokio = "1.36.0" -tracing = "0.1.40" - -[dev-dependencies] -insta = { version = "1.40.0", features = ["yaml", "glob", "json"] } -schemars = "0.8.16" diff --git a/crates/ndc-clickhouse/src/main.rs b/crates/ndc-clickhouse/src/main.rs index 2b64860..23e4616 100644 --- a/crates/ndc-clickhouse/src/main.rs +++ b/crates/ndc-clickhouse/src/main.rs @@ -1,4 +1,4 @@ -use ndc_clickhouse::connector::setup::ClickhouseConnectorSetup; +use ndc_clickhouse_core::connector::setup::ClickhouseConnectorSetup; use ndc_sdk::{connector::ErrorResponse, default_main::default_main}; #[tokio::main] From 852d3d59980d350e24fcc725d5c0184d18ac9081 Mon Sep 17 00:00:00 2001 From: Benoit Ranque Date: Wed, 30 Oct 2024 13:50:32 -0400 Subject: [PATCH 2/3] remove openssl dependency by removing ndc-sdk default features --- Cargo.lock | 99 +++++++++++++++++++----------------------------------- Cargo.toml | 6 ++-- 2 files changed, 39 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a5e2d0..0acac35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -352,12 +352,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" -[[package]] -name = "colorful" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97af0562545a7d7f3d9222fcf909963bec36dcb502afaacab98c6ffac8da47ce" - [[package]] name = "common" version = "1.0.5" @@ -1079,16 +1073,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1216,7 +1200,6 @@ dependencies = [ "http 0.2.12", "ndc-models", "ndc-sdk-core", - "ndc-test", "opentelemetry", "opentelemetry-http", "opentelemetry-otlp", @@ -1246,7 +1229,6 @@ dependencies = [ "http 0.2.12", "mime", "ndc-models", - "ndc-test", "prometheus", "serde", "serde_json", @@ -1255,27 +1237,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "ndc-test" -version = "0.1.6" -source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.6#d1be19e9cdd86ac7b6ad003ff82b7e5b4e96b84f" -dependencies = [ - "async-trait", - "clap", - "colorful", - "indexmap 2.5.0", - "ndc-models", - "rand", - "reqwest 0.11.27", - "semver", - "serde", - "serde_json", - "smol_str", - "thiserror", - "tokio", - "url", -] - [[package]] name = "nom" version = "7.1.3" @@ -1837,11 +1798,11 @@ dependencies = [ "js-sys", "log", "mime", - "mime_guess", "native-tls", "once_cell", "percent-encoding", "pin-project-lite", + "rustls 0.21.12", "rustls-pemfile 1.0.4", "serde", "serde_json", @@ -1940,6 +1901,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.7", + "sct", +] + [[package]] name = "rustls" version = "0.22.4" @@ -1949,7 +1922,7 @@ dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.102.7", "subtle", "zeroize", ] @@ -1963,7 +1936,7 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.102.7", "subtle", "zeroize", ] @@ -2006,6 +1979,16 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustls-webpki" version = "0.102.7" @@ -2080,6 +2063,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.11.1" @@ -2103,12 +2096,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - [[package]] name = "serde" version = "1.0.209" @@ -2465,7 +2452,6 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -2751,15 +2737,6 @@ dependencies = [ "syn", ] -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2828,12 +2805,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "walkdir" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index 7ef375f..c04a977 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,10 @@ package.edition = "2021" [workspace.dependencies] ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.6" } -ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.5.0", package = "ndc-sdk" } -ndc-sdk-core = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.5.0", package = "ndc-sdk-core" } +ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.5.0", package = "ndc-sdk", features = [ + "rustls", +], default-features = false } +ndc-sdk-core = { git = "https://github.com/hasura/ndc-sdk-rs", tag = "v0.5.0", package = "ndc-sdk-core", default-features = false } # insta performs better in release mode [profile.dev.package] From 3fc084c6bcc488b22fb21709c8945f4421237338 Mon Sep 17 00:00:00 2001 From: Benoit Ranque Date: Wed, 30 Oct 2024 13:54:02 -0400 Subject: [PATCH 3/3] move Level use to debug only block, makes linter happy --- crates/ndc-clickhouse-core/src/connector/handler/query.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ndc-clickhouse-core/src/connector/handler/query.rs b/crates/ndc-clickhouse-core/src/connector/handler/query.rs index 7ea5d82..d34ce04 100644 --- a/crates/ndc-clickhouse-core/src/connector/handler/query.rs +++ b/crates/ndc-clickhouse-core/src/connector/handler/query.rs @@ -1,7 +1,7 @@ use common::{client::execute_query, config::ServerConfig}; use ndc_models as models; use ndc_sdk_core::{connector::ErrorResponse, json_response::JsonResponse}; -use tracing::{Instrument, Level}; +use tracing::Instrument; use crate::{connector::state::ServerState, sql::QueryBuilder}; @@ -12,6 +12,7 @@ pub async fn query( ) -> Result, ErrorResponse> { #[cfg(debug_assertions)] { + use tracing::Level; // this block only present in debug builds, to avoid leaking sensitive information let request_string = serde_json::to_string(&request).map_err(ErrorResponse::from_error)?; @@ -26,6 +27,7 @@ pub async fn query( #[cfg(debug_assertions)] { + use tracing::Level; // this block only present in debug builds, to avoid leaking sensitive information let unsafe_statement_string = QueryBuilder::new(&request, configuration) .build_inlined()? @@ -65,6 +67,7 @@ pub async fn query( #[cfg(debug_assertions)] { + use tracing::Level; // this block only present in debug builds, to avoid leaking sensitive information let result_string = std::str::from_utf8(&rowsets).map_err(ErrorResponse::from_error)?;