Skip to content

Add MSSQL DB client #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Nov 3, 2022
Merged

Add MSSQL DB client #37

merged 47 commits into from
Nov 3, 2022

Conversation

Sylvestre67
Copy link

@Sylvestre67 Sylvestre67 commented Oct 21, 2022

Resolves Microsoft Server SQL DB client

Description

Adds a database client for MS SQL databases. The client is set up so it can be seamlessly imported in the data-connector project.

Besides the main client, it also adds the basic to write mocha integration-test and the docker-compose setup to run the test from a local environment and CI.

Review notes

The core of the changes can be found in the new lib/mssql.js file. It defines the check and query method, and connection pool.

The routing has been adjusted to match the one exposed in data-connector.

Tests

To run the test locally with Docker, run

$ yarn run test:local

Test will:

  • spin up an mssql instance, using the azure-sql-edge docker image
  • seed the DB from the test_mssql.bak backup file and create another read only user
  • run the test

To run the test as in CI with Docker, run

$ yarn run test:ci

Test will:

  • spin up an mssql instance, using the server:2019-latest docker image
  • seed the DB from the test_mssql.bak backup file and create another read only user
  • run the test

NOTE: The ci tests won't run on a MacBook PRO M1 environment. Run on a Fedora Linux distribution successfully.

Risk

[If something goes wrong, how big of a problem is it? Consider only the impact, not the probability.]
[😅 Low - We'll need to add a PR to roll this back, but it won't cause problems for users]

@Sylvestre67 Sylvestre67 marked this pull request as ready for review October 25, 2022 20:53

if (!validate(body)) throw badRequest();

res.setHeader("Content-Type", "text/plain");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the right content-type? I can't remember if there is a reason for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping on this

Copy link
Author

@Sylvestre67 Sylvestre67 Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this header lies on how the compression library is filtering the request it needs to compress or not. Compression happens in data connector (here) and is filtered/applied by the compression library following this /^text\/|\+(?:json|text|xml)$/i re-pattern (see here)

@wiltsecarpenter
Copy link
Contributor

This won't actually work for people unless the other PR with the UI changes is deployed, and that PR won't work until this is deployed. We could just merge this and tell people not to use it, or merge it and not make a new release for it until we merge the client, or just merge when the other PR is ready.

@wiltsecarpenter
Copy link
Contributor

Approved. This all looks good to me, but I think we should loop Visnu in on how best to merge it.


if (!validate(body)) throw badRequest();

res.setHeader("Content-Type", "text/plain");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping on this

@Sylvestre67 Sylvestre67 merged commit eade79c into main Nov 3, 2022
@Sylvestre67 Sylvestre67 deleted the syl/mssql-client branch November 3, 2022 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants