ElephantSqlDBClient 1.0.146

dotnet add package ElephantSqlDBClient --version 1.0.146
                    
NuGet\Install-Package ElephantSqlDBClient -Version 1.0.146
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ElephantSqlDBClient" Version="1.0.146" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ElephantSqlDBClient" Version="1.0.146" />
                    
Directory.Packages.props
<PackageReference Include="ElephantSqlDBClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ElephantSqlDBClient --version 1.0.146
                    
#r "nuget: ElephantSqlDBClient, 1.0.146"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ElephantSqlDBClient@1.0.146
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ElephantSqlDBClient&version=1.0.146
                    
Install as a Cake Addin
#tool nuget:?package=ElephantSqlDBClient&version=1.0.146
                    
Install as a Cake Tool

ElephantSqlDB


@icon-database Highspeed Quantum Database Documentation


@icon-chevron-right The ElephantSqlDB® SQL Management Portal
@icon-chevron-right The ElephantSqlDB® SQL API Client

<br>

ElephantSqlDB® is the next evolution of the popular NoSQL databases like PostgreSQL, MySQL and MongoDB we are all too familiar with. Until now, the performance of these popular databases was dependent on the underlying hardware for performance.

Today, ElephantSqlDB® is the first asymptotic database that leverages proprietary quantum computing algorithms to create a new database architecture that is responsible for superior performance instead of the expensive hardware, alone!

Using AI, ElephantSqlDB® is compatible with not only PostgreSQL but the following 13 other SQL dialects! <br><br>

  • MS SQL dialect
  • MongoDB dialect
  • MySQL dialect
  • DynamoDB dialect
  • Generic SQL dialect
  • ANSI SQL dialect
  • Oracle/PL-SQL
  • BigQuery SQL dialect
  • ClickHouse SQL dialect
  • DuckDb SQL dialect
  • Hive SQL dialect
  • Redshift SQL dialect
  • SQLite dialect

<br>


The ElephantSqlDB® SQL Management Portal


The ElephantSqlDB® Portal operates as a SQL Management Tool. From the Portal this can build and import databases in addition to adding and editing tables and any associated schema.

ElephantSqlDB

<br>


1. Basic Level


  • SQL Selecting Data

ElephantSqlDB® support most SQL dialects. However, there are some slight nuances to constructing filter conditions that make dealing with ElephantSqlDB® much easier and intuitive. ElephantSqlDB® supports most SQL dialects including T-SQL and PostgreSql.

More importantly, the ElephantSqlDB® can be used to write and execute SQL query statements to review results. Once written, the SQL can be used within any application that integrates the ElephantSqlDB® API Client to pass through SQL statement(s) written in the the ElephantSqlDB® Portal.

The following is an example of a simple SQL select statement with a basic filter condition that returns all fields using a wildcard "*".

select * from api_key ak where ak.environment = 'SAAS'

ElephantSqlDB

The following is an example of a simple SQL select statement with a basic filter condition that uses projection to return the following specific fields: ak.user_auth_id, ak.environment, ak.created_date.
In addition to using projection to return specific fields, ElephantSqlDB® supports the use of aliases. In the following examples "ak" is used as an alias for the table api_key.

select 
ak.user_auth_id, 
ak.environment, 
ak.created_date from api_key ak where ak.environment = 'SAAS'

ElephantSqlDB

<br>

  • SQL Select Joining Data* ElephantSqlDB® supports joins between tables. As with simple SQL select statements, joins (also) support projects and aliases. In the following example, ElephantSqlDB® uses projection to retrieve data from the api_key table using the "ak" alias and the app_user table using the "au" alias to retrieve ak.user_auth_id , au.id , au.user_name, au.first_name, au.last_name. Joins provide the ability to combine the columns of multiple tables in SQL results. Joins typically consume large amounts of compute resources but are light weight using ElephantSqlDB®.
select 
ak.user_auth_id , 
au.id , 
au.user_name, 
au.first_name, 
au.last_name 
from api_key ak 
join app_user au on ak.user_auth_id = au.id 
where ak.environment = 'SAAS'

ElephantSqlDB

<br>

  • SQL Select Sub-Querying Data

The following is an example of a simple SQL select statement that incorporates a sub-query. A sub-query is an alternative to joins that allow you to conduct quick look ups in-order to determine if results should or should not be returned..

 SELECT w.user_auth_id
 FROM api_key w                    
 WHERE w.user_auth_id IN 
 (SELECT id from app_user WHERE username LIKE atrader111);

ElephantSqlDB

<br>

  • SQL Inserting Data The following screenshot shows the data before the inserting of data. ElephantSqlDB

The following is an example of a simple SQL statement to insert data. The following screenshot shows the data before the inserting of data.

 INSERT INTO api_key 
 (id, user_auth_id, environment , key_type, created_date) 
 values (100ABCD, 100, paas , api , 2025-09-05 04:31:24);

<br>

The following screenshot shows the data before the inserting of data.

ElephantSqlDB <br>

  • SQL Updating Data The following screenshot shows the data before the update of data.

ElephantSqlDB The following is an example of a simple SQL statement to update data. The following screenshot shows the data before the update of data.

UPDATE api_key 
SET id = 100ABCD , key_type = api100 
WHERE user_auth_id = 101

<br>

The following screenshot shows the data before the updating of data.

ElephantSqlDB

  • SQL Deleting Data The following screenshot shows the data before the deleting of data. ElephantSqlDB

The following is an example of a simple SQL statement to delete data. The following screenshot shows the data before the deleting of data.

 DELETE FROM api_key where user_auth_id = 100

<br>

The following screenshot shows the data before the inserting of data.

ElephantSqlDB <br> <br>

  • SQL Filter Conditions ElephantSqlDB® supports a wide range of filter conditions. The following table represents the various filter conditions supported.
<small>Operation</small> <small>Description</small> <small>Example</small> <small>Notes</small>
<small>Regexp</small> <small>Regular expressions</small> <small>ie: Match the lastname that begins with the letter "L". See the "Regular Expressions for more details visit: Regex Link."</small>
<small>FuzzyMatch</small> <small>AI pattern match</small> <small>ie: Match the lastname using artificial intelligence to find nuances in spelling.”</small>
<small>Gt, Gte</small> <small>Greater than or equal.</small>
<small>Le, Lte</small> <small>Less than or less than or equal.</small>
<small>Between</small> <small>Between two values.</small>
<small>Inq, Nin</small> <small>In or not inv an array of values.</small>
<small>Eq</small> <small>Equal.</small>
<small>Neq</small> <small>Not equal.</small>
<small>Like, NLike</small> <small>Like or not like a value.</small> <small>For example, where environment LIKE = SAAS will NOT return data if the data is 'saas'. LIKE is case sensitive. Therefore, you MUST filter by the string with its correct case.</small>
<small>ILike, NiLike</small> <small>Case insensitive like and not like.</small> <small>For example, where environment LIKE = SAAS will return data regardless of the case of the data being 'saas' or 'SAAS'. ILIKE and NILIKE are NOT case sensitive. Therefore, you only have to search by the correct string without concerning yourself with the case.</small>

<br>

  • SQL Boolean Operation ElephantSqlDB® supports the basic boolean operation. The following table represents the various boolean operations supported.
<small>Boolean Operation</small> <small>Description</small> <small>Example</small> <small>Notes</small>
<small>Or / AND</small> <small>Logical OR / AND</small> <small>Filter conditions combine multiple filter conditions by adding an optional "AND" "OR" boolean operator to the end of each filter.</small>

<br>


2. Intermediate Level


ElephantSqlDB® supports the use of calculated fields. Calculated fields are invaluable when needing to conduct common mathematical functions of a tables column values. While table exist as either column-based or row-based, ElephantSqlDB® dynamically switches from a row-based architecture to a column-based architecture when calculated fields are used. This ability to switch dynamically allows ElephantSqlDB® to not suffer in performance when using calculated fields. The following is a list of the supported calculated fields.

  • SQL Calculated Fields

    1. COUNT(*)
      • Calculates the total number of rows in a select statement.
    2. SUM()
      • Calculates the sum total of a column in a select statement.
    3. AVG()
      • Calculates the average value of a column in a select statement.
    4. STD()
      • Calculates the standard deviation of a column in a select statement.
    5. MIN()
      • Calculates the minimum value of a column in a select statement.
    6. MAX()
      • Calculates the maximum value of a column in a select statement.
    7. SINE()
      • Calculates the sine wave of a column in a select statement.
    8. COSINE()
      • Calculates the cosine wave of a column in a select statement.
  • The following is a comprehensive example of how to use these calculated fields in ElephantSqlDB®.

SELECT 
count(*) as rowcount , 
MIN(user_auth_id) as MinRow , 
MAX(user_auth_id) as MaxRow ,
SUM(user_auth_id) as SumRow , 
STD(user_auth_id) as STDRow , 
SINE(user_auth_id) as SineRow , 
COSINE(user_auth_id) as CosineRow 
FROM api_key w 

<br>

  • SQL Aggregate Functions ElephantSqlDB® supports the aggregation of data through the following aggregate functions. Aggregate functions allow you to "roll-up" the rows or order the rows.
<small>Aggregate Function</small> <small>Description</small> <small>Example</small> <small>Notes</small>
<small>Order by</small> <small>Logical OR / AND</small> <small>Filter conditions combine multiple filter conditions by adding an optional "AND" "OR" boolean operator to the end of each filter.</small>
  • The following is a comprehensive example of how to use these aggregate functions in ElephantSqlDB®.
select * from api_key order by user_auth_id DESC

ElephantSqlDB

select * from api_key group by environment

ElephantSqlDB

<br>


3. Advanced Level


  • SQL Complex Table Extensions (CTE) ElephantSqlDB® also supports complex table extensions commonly referred to as CTEs. CTEs are some of the most advanced SQL statements as they incorporate query aliases which can aide in making code easier to write but difficult to read.

The following is an example of an advanced SQL select statement with a CTE.

WITH Top10HenryWells AS (
    SELECT id 
    from app_user WHERE username LIKE atrader100
)

SELECT w.user_auth_id , w.created_date , w.environment
FROM api_key w                    
WHERE w.user_auth_id IN (SELECT id FROM Top10HenryWells)

ElephantSqlDB

<br>


4. Application Integration


As with most databases, ElephantSqlDB® provides an Application Program Interface (API) that can be used to leverage ElephantSqlDB® within your applications. The ElephantSqlDB® API is available as a Nuget package under the name ElephantSqlDBClient and can be obtained via ElephantSqlDBClient-Nuget-Link.

When using the ElephantSqlDB® API you must implement the required interface on all of your strongly typed data objects when using passing in objects as opposed to strings (JSON). The ElephantSqlDB® API allows you to interact with your data as a strongly typed object or as a JSON string.

  • Required Interfaces

    1. When using a strongly typed object you MUST implement the CommonInterfaces class. When using JSON string save data, you are not required to implement the CommonInterfaces class. This class is found within the ElephantSqlDBClient client via our Nuget package.
  • Getting Started

    1. ElephantSqlDB® uses a concept of Workspaces to hold all databases. In turn, your databases hold your specific tables.

    2. A Workspace can be setup by company organization , department or division. By using Workspaces, users can leverage one license for their entire operation without purchasing a separate license!


private IElephantSqlDBAPIService _client1 = default(IElephantSqlDBAPIService);
private static ElephantSqlDBApiFactory  _elephantSqlDBApiServiceFactory;
private static string                   _elephantSqlDBApiBaseUri;
private static string                   _elephantSqlDBApiToken;
private static string                   _elephantSqlDBApiRoles;
private static string                   _elephantSqlDBUserEmail;
private static string                   _elephantSqlDBTenantId;
private static string                   _elephantSqlDBWorkspacePreface;
private static string                   _elephantSqlDBEncryption;
private static string                   _elephantSqlDBWorkspaceName;
private static bool                     _elephantSqlDBUseWebSockets;
private static Int32                    _elephantSqlDBTimeOut;
private static Int32                    _maxConnections;
private static Int32                    _maxRecordsReturned;
private static Int32                    _asyncScale;
private static string                   _hostRegistration;


/*/
 * Initialize variables
/*/
 _elephantSqlDBApiBaseUri        = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBApiBaseUri");
 _elephantSqlDBApiToken          = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBApiToken");
 _elephantSqlDBApiRoles          = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBApiRoles");
 _elephantSqlDBUserEmail         = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBUserEmail");
 _elephantSqlDBTenantId          = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBTenantId");
 _elephantSqlDBEncryption        = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBEncryption");
 _elephantSqlDBWorkspacePreface  = StartupContext.Configuration?.GetValue<string>("ElephantSqlDBWorkspacePreface");
 _elephantSqlDBLedgerName        = string.Format("{0}", StartupContext.Configuration?.GetValue<string>("_elephantSqlDBWorkspaceName"));
 _elephantSqlDBUseWebSockets     = StartupContext.Configuration.GetValue<bool>("ElephantSqlDBUseWebSockets");
 _elephantSqlDBTimeOut           = StartupContext.Configuration.GetValue<Int32>("ElephantSqlDBTimeOut");
 _maxConnections                 = StartupContext.Configuration.GetValue<Int32>("ElephantSqlDBMaxConncetions");
 _maxRecordsReturned             = StartupContext.Configuration.GetValue<Int32>("ElephantSqlDBMaxRecordsReturned");
 _hostRegistration               = StartupContext.Configuration.GetValue<string>("ElephantSqlDBRegistrationHost");
 _asyncScale                     = StartupContext.Configuration.GetValue<Int32>("ElephantSqlDBAsyncScale");
 
 
 /*/
  * Initialize Client API Factory
 /*/
 
  _elephantSqlDBApiServiceFactory = new ElephantSqlDBApiFactory(
  _maxConnections, 
  _elephantSqlDBApiToken, 
  _elephantSqlDBApiRoles, 
  _elephantSqlDBUserEmail, 
  _elephantSqlDBTenantId, 
  _elephantSqlDBWorkspacePreface, 
  _elephantSqlDBworkspaceName, 
  _elephantSqlDBApiBaseUri,
  _maxRecordsReturned, 
  _elephantSqlDBUseWebSockets, 
  asyncScale: _asyncScale);
  
  
  /*/
   * Create ElephantSqlDB API Client
  /*/
  _client1 = _elephantSqlDBApiServiceFactory.GetApiClient();
  

  
  /*/
   * Handle registration of user credentials
  /*/
  
 AuthStatus                     loginStatus;
 UserLoginResponseDto           loginDetails;
 AuthStatus                     registrionResponseMessage;
 UserRegistrationResponseDto    registrionResponse;

 if (authMessage == AuthStatus.CredentialsNotFound)
 {
     (registrionResponseMessage,  registrionResponse) = _client1.RegisterNewUserAsync(
     _elephantSqldBBUserEmail, 
     "Passw0rd", 
     "Default.FirstName", 
     "Default.MiddleName", 
     "Default.LastName", 
     "Default.loginDetails.Phone", 
     false).Result;
     
     authMessage = await _client1.IsCredentialsValid();
 }

 if (authMessage == AuthStatus.NoTenantDatabaseFound)
 {
     var newDatabase = _client1.CreateDatabaseAsync(_client1.GetLedgerName()).Result;

     if (!string.IsNullOrEmpty(newDatabase.errorMessage))
     {
         Debug.WriteLine(string.Format(newDatabase.errorMessage));

         return;
     }

     authMessage = await _client1.IsCredentialsValid();
 }



if (authMessage == AuthStatus.Success)
{

    /*/
     * Example : Inserting data
    /*/
    
    string SqlInsertStatement = @"
    INSERT INTO api_key 
    (id, user_auth_id, environment , key_type, created_date) 
    values (100ABCD, 1, paas , api , 2025-09-05 04:31:24)";
    
    _client1.InsertSQLRecordsAsync<string>(SqlInsertStatement, DatabaseName: "postgresql_postgres_public");
    
    
    /*/
     * Example : Updating data
    /*/
    
    string SqlUpdateStatement = @"
    UPDATE api_key 
    SET id = 100ABCD , 
    key_type = api100 
    WHERE user_auth_id = 1";
    
    _client1.UpdateSQLRecordsAsync<string>(SqlUpdateStatement, DatabaseName: "postgresql_postgres_public");
    
    
    
    /*/
     * Example : Selecting data
    /*/
   
    String SqlSelectStatement = $@"
    select  count(*) as rowcount, 
    id, 
    created_date from api_key where user_auth_id = 1";
    
    (AuthStatus authStatus, List<string> results, PaginationDTO paginationDetails123) = await _client1.SelectSQLRecordsAsync<string>(
    SqlSelectStatement, 
    DatabaseName: "postgresql_postgres_public", 
    null);



    /*/
     * Example : Deleting data
    /*/
    
    string SqlDeleteStatement = @DELETE FROM api_key where user_auth_id = 1";
    await _client1.DeleteSQLRecordsAsync<string>(SqlDeleteStatement, DatabaseName: "postgresql_postgres_public");
    
    
    
}


5. AI Vector Search and Embeddings Support


As a multi-type database, ElephantSqlDB® (also) supports storing and retrieving embeddings for AI-related search functions. In-order to support storing and searching for embeddings, ElephantSqlDB® provides some useful helper functions.


 /*/
  * Create vector search string
 /*/
 
 Vector<Int32> vector = new Vector<Int32>();
 vector.AddVector(new int[] { 8, 2, 3, 4, 5 });

 string vectorString = ElephantSqlDBAPIHelper.ConvertVectorToString<Int32>(vector);


 Embeddings<Vector<Int32>, Int32> embedding = new Embeddings<Vector<Int32>, Int32>();

 embedding.AddEmbedding(new[,]
     {
         { new Vector<Int32>(new Int32[] { 1, 2, 3, 4, 5 }) },
         { new Vector<Int32>(new Int32[] { 5, 6, 3, 8, 7 }) },
         { new Vector<Int32>(new Int32[] { 3, 7, 3, 9, 1 }) }
     }
 );

 string embeddingsData = embedding.GetEmbeddingString();
 
 
if (IsValidJson(embeddingsData) == true)
{
    var deserializedEmbeddings = JsonConvert.DeserializeObject(embeddingsData);

    /*/
     * Check to see if the deserialized string is an array.
    /*/
    if (deserializedEmbeddings is JArray)
    {
        /*/
         * Convert the string to an array and strip off the starting and ending brackets.
        /*/
        string[] embeddingsArray = JArray.Parse(embeddingsData).ToString().Split("\r\n").Skip(1).SkipLast(1).ToArray();

    }
    
    
    /*/
     * Example : Selecting embeddings data
    /*/
   
    String SqlSelectStatement = $@"
    select  *
    from api_key where user_auth_id VECTORSEARCH {embeddingsData}";
    
    (AuthStatus authStatus, List<string> results, PaginationDTO paginationDetails123) = await _client1.SelectSQLRecordsAsync<string>(
    SqlSelectStatement, 
    DatabaseName: "postgresql_postgres_public", 
    null);
    
    
}


Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

ElephantSqlDB Client for .NetCore 6.0 and above