Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 2.01 KB

development.md

File metadata and controls

81 lines (58 loc) · 2.01 KB

SQL Server Connector Development

Instructions for developers who wish to contribute or build upon the connector:

Prerequistes

  1. Install rustup
  2. Install additional tools:
    • cargo install cargo-watch cargo-insta
  3. Install just
  4. Install Prettier
  5. Install Docker
  6. Install protoc. Here are a few options:
    • brew install protobuf
    • apt-get install protobuf-compiler
    • dnf install protobuf-compiler

Compile

cargo build

Create a configuration

See ../crates/cli/readme.md.

Run

Run the SQL Server connector with:

cargo run serve --configuration '<directory>'

Test

To test SQL Server, run:

cargo test

Write a database execution test

  1. Create a new file under crates/ndc-sqlserver/tests/goldenfiles/<your-test-name>.json
  2. Create a new test in crates/ndc-sqlserver/tests/query_tests.rs that looks like this:
    #[tokio::test]
    async fn select_5() {
            let result = run_query("select_5").await;
            insta::assert_json_snapshot!(result);
        }
  3. Run the tests using just test or cargo test

Write a SQL translation snapshot test

  1. Create a new folder under crates/query-engine/translation/tests/goldenfiles/<your-test-name>/
  2. Create request.json and tables.json files in that folder to specify your request
  3. Create a new test in crates/query-engine/translation/tests/tests.rs that looks like this:
    #[tokio::test]
    async fn select_5() {
        let result = common::test_translation("select_5").await;
        insta::assert_snapshot!(result);
    }
  4. Run the tests using just test or cargo test

Linting

Run just lint to run clippy linter

run just lint-apply to attempt to autofix all linter suggestions

Formatting

Check your formatting is great with just format-check.

Format all Rust code with just format.