Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Issue #70 - Add Serverless Support #73

Merged
merged 21 commits into from
Nov 21, 2024

Conversation

currantw
Copy link
Contributor

@currantw currantw commented Nov 13, 2024

Description

Adds support for OpenSearch Serverless to the ODBC driver.

Issues Resolved

#70

Check List

  • New functionality includes testing.
    Automated testing has been deferred to future issue (see below). See comments for summary of manual testing.
  • All tests pass, including unit test, integration test and doctest.
    Pipeline job build-mac is failing. This is an existing failure on main, and I have raised a new issue to fix it (see below)
  • New functionality has been documented.
  • New functionality has javadoc added - Not applicable
  • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Related Issues

@currantw currantw force-pushed the AOS-2291_serverless branch from 0f13e9e to b855e2d Compare November 13, 2024 23:58
.gitignore Show resolved Hide resolved
src/sqlodbc/dlg_specific.h Show resolved Hide resolved
src/sqlodbc/opensearch_communication.cpp Show resolved Hide resolved
src/sqlodbc/dlg_specific.c Outdated Show resolved Hide resolved
@currantw
Copy link
Contributor Author

currantw commented Nov 18, 2024

The build_mac action is also failing on the main project (https://github.com/opensearch-project/sql-odbc). Currently, building locally on Mac fails unless the -Werror flag is removed, so this is perhaps the cause of this failure.

Raised this issue to address this: #74

@currantw
Copy link
Contributor Author

currantw commented Nov 18, 2024

Automated testing is non-trivial, and has been deferred to #75. In the meantime, we have performed the following to test this new behaviour on Mac:

TESTING SERVERLESS

Amazon OpenSearch Serverless cluster was setup for testing.
See comments for more details.

✅ ODBC connects successfully with iodbctest.

TESTING NON-SERVERLESS WITH EDITED HOST FILE

A local OpenSearch cluster was setup for testing.

✅ ODBC connects successfully with iodbctest.

NOTES ON TESTING

The following steps where taken to setup and test the Serverless cluster:

  1. Created a new OpenSearch Serverless cluster that includes SQL.
  2. Updated my AWS credentials file ( to add opensearchodbc profile with the appropriate access key, secret access key, and session token.
  3. Load some test data to OpenSearch using Postman.
  4. Downloaded the repo and build the .dll using CMake.
  5. Updated my odbc.ini and odbcinst.ini files to configure the ODBC (see below)
  6. Download iodbctest (brew install libiodbc).
  7. Run iodbctest, connect to the corresponding DSN, and query the test data.
image
# odbc.ini

[ODBC Data Sources]
OpenSearchServerlessDSN = OpenSearchODBC

[OpenSearchServerlessDSN]
Host                 = https://<HOST-URL>.aoss.amazonaws.com
Port                 = 443
UseSSL               = 1
ResponseTimeout      = 10
HostnameVerification = 1
Region               = <AWS_REGION>
Auth                 = AWS_SIGV4
LogOutput            = /Library/ODBC/opensearch-sql-odbc
Driver               = <PROJECT_ROOT>/build/odbc/lib/libsqlodbc.dylib
ServerlessOverride   = 1

# odbcinst.ini
[ODBC Drivers]
OpenSearchODBC = Installed

[OpenSearchODBC]
Driver = <PROJECT_ROOT>/build/odbc/lib/libsqlodbc.dylib
Setup  = <PROJECT_ROOT>//build/odbc/lib/libsqlodbc.dylib

src/sqlodbc/opensearch_communication.cpp Outdated Show resolved Hide resolved
src/sqlodbc/opensearch_communication.h Outdated Show resolved Hide resolved
@@ -272,6 +272,7 @@ typedef struct connection_options {
std::string port;
std::string timeout;
std::string fetch_size;
std::string is_serverless;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you make this a bool please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! ✅

@currantw
Copy link
Contributor Author

Automated testing is non-trivial, and has been deferred to #75. In the meantime, we have performed the following to test this new behaviour on Mac:

TESTING SERVERLESS

Amazon OpenSearch Serverless cluster was setup for testing. See comments for more details.

✅ ODBC connects successfully with iodbctest.

TESTING NON-SERVERLESS WITH EDITED HOST FILE

A local OpenSearch cluster was setup for testing.

✅ ODBC connects successfully with iodbctest.

NOTES ON TESTING

The following steps where taken to setup and test the Serverless cluster:

  1. Created a new OpenSearch Serverless cluster that includes SQL.
  2. Updated my AWS credentials file ( to add opensearchodbc profile with the appropriate access key, secret access key, and session token.
  3. Load some test data to OpenSearch using Postman.
  4. Downloaded the repo and build the .dll using CMake.
  5. Updated my odbc.ini and odbcinst.ini files to configure the ODBC (see below)
  6. Download iodbctest (brew install libiodbc).
  7. Run iodbctest, connect to the corresponding DSN, and query the test data.
image ``` # odbc.ini

[ODBC Data Sources]
OpenSearchServerlessDSN = OpenSearchODBC

[OpenSearchServerlessDSN]
Host = https://.aoss.amazonaws.com
Port = 443
UseSSL = 1
ResponseTimeout = 10
HostnameVerification = 1
Region = <AWS_REGION>
Auth = AWS_SIGV4
LogOutput = /Library/ODBC/opensearch-sql-odbc
Driver = <PROJECT_ROOT>/build/odbc/lib/libsqlodbc.dylib
ServerlessOverride = 1

odbcinst.ini

[ODBC Drivers]
OpenSearchODBC = Installed

[OpenSearchODBC]
Driver = <PROJECT_ROOT>/build/odbc/lib/libsqlodbc.dylib
Setup = <PROJECT_ROOT>//build/odbc/lib/libsqlodbc.dylib

@MaxKsyunz MaxKsyunz self-requested a review November 21, 2024 04:31
@MaxKsyunz MaxKsyunz merged commit 1ac3e6d into opensearch-project:main Nov 21, 2024
5 of 8 checks passed
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.

4 participants