Skip to content

Commit

Permalink
Added ODBC driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenstott committed Nov 13, 2024
1 parent bf69e44 commit f6cda4a
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Hasura Integration Suite

Tools for integrating with Hasura Data Delivery Network (DDN) in two key ways:
Tools for integrating with Hasura Data Delivery Network (DDN) in three key ways:
1. Native Data Connector (NDC) toolkit for ingesting data sources into Hasura DDN
2. SQL-based tools for querying Hasura DDN endpoints
3. ODBC-based access to Hasura DDN

## Native Data Connector Development

Expand Down Expand Up @@ -74,6 +75,20 @@ Lightweight HTTP server for executing SQL queries against Hasura DDN endpoints v
- Connection pooling
- Environment-based configuration

## ODBC-based Access to Hasura DDN

### [DDN ODBC Driver](calcite-rs-jni/odbc/README.md)
The DDN ODBC Driver is a .NET Standard 2.0 library that provides an ODBC-compliant interface to interact with the Hasura DDN platform. This driver allows you to execute SQL queries and retrieve data from your Hasura DDN instance using a familiar ODBC-based API.

#### Features
- Supports ODBC API for executing SQL queries and retrieving data
- Provides a simple and intuitive connection management interface
- Automatically starts and manages a Java application server in the background
- Supports reading metadata (tables, columns) from the Hasura DDN instance
- Operates in a read-only mode to ensure data integrity

For detailed usage instructions, please refer to the [DDN ODBC Driver README](DDN-ODBC/README.md).

## Getting Started

Each component has its own setup and configuration requirements. Please refer to the individual component documentation linked above for detailed instructions.
Expand All @@ -93,6 +108,7 @@ For development setup and contribution guidelines, please refer to each componen
- [JDBC Connector Development Guide](calcite-rs-jni/jdbc/README.md#building-from-source)
- [Python DB-API Development](calcite-rs-jni/py_graphql_sql/README.md#prerequisites)
- [SQL HTTP Server Development](calcite-rs-jni/sqlengine/README.md#building-and-running)
- [DDN ODBC Driver Development](DDN-ODBC/README.md)

## License

Expand All @@ -102,6 +118,7 @@ Different components are released under different licenses:
- Python DB-API: MIT License
- SQL HTTP Server: MIT License
- NDC Calcite: License information not specified
- DDN ODBC Driver: License information not specified

## Support

Expand Down
73 changes: 73 additions & 0 deletions calcite-rs-jni/odbc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# DDN ODBC Driver

The DDN ODBC Driver is a .NET Standard 2.0 library that provides an ODBC-compliant interface to interact with the Hasura DDN (Data Delivery Network) platform. This driver allows you to execute SQL queries and retrieve data from your Hasura DDN instance using a familiar ODBC-based API.

## Features

- Supports ODBC API for executing SQL queries and retrieving data
- Provides a simple and intuitive connection management interface
- Automatically starts and manages a Java application server in the background
- Supports reading metadata (tables, columns) from the Hasura DDN instance
- Operates in a read-only mode to ensure data integrity

## Usage

To use the DDN ODBC Driver, follow these steps:

1. Add a reference to the `DDN-ODBC.dll` assembly in your project.
2. Create an instance of the `DDN_ODBC` class and set the connection string:

```csharp
var connectionString = "jdbc:ddn://your-hasura-instance.com:8080";
var connection = new DDN_ODBC(connectionString);
```

3. Open the connection:

```csharp
connection.Open();
```

4. Create a command and execute SQL queries:

```csharp
using (var command = connection.CreateDbCommand())
{
command.CommandText = "SELECT * FROM users";
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
// Process the data
}
}
}
```

5. Close the connection when you're done:

```csharp
connection.Close();
```

## Architecture

The DDN ODBC Driver is built on top of the .NET Standard 2.0 framework and uses the following key components:

1. `DDN_ODBC` class: The main entry point for the driver, responsible for managing the connection, starting the Java application server, and executing SQL queries.
2. `DDN_OdbcCommand` class: Implements the ODBC command interface, allowing you to execute SQL queries and retrieve data.
3. `DDN_OdbcDataReader` class: Implements the ODBC data reader interface, providing a way to iterate over the result set.
4. `DDNDataParameter` and `DDNDataParameterCollection` classes: Provide a way to manage input parameters for SQL queries.
5. `SqlQuery` class: Represents a SQL query to be executed on the Hasura DDN instance.

The driver uses an embedded Java application server to communicate with the Hasura DDN instance. The Java application server is started and managed by the `DDN_ODBC` class, and all SQL queries are executed through this server.

## Limitations

- The driver currently operates in a read-only mode, meaning that it does not support any write operations (insert, update, delete) on the Hasura DDN instance.
- Transactions are not supported, as the Hasura DDN instance is designed for read-only access.
- The driver does not provide any advanced features like connection pooling or asynchronous operations. It focuses on providing a basic, ODBC-compliant interface to interact with the Hasura DDN platform.

## Contributing

If you encounter any issues or have suggestions for improvements, please feel free to create a new issue or submit a pull request on the project's GitHub repository.

0 comments on commit f6cda4a

Please sign in to comment.