Hiperspace.SQL
2.4.4
dotnet add package Hiperspace.SQL --version 2.4.4
NuGet\Install-Package Hiperspace.SQL -Version 2.4.4
<PackageReference Include="Hiperspace.SQL" Version="2.4.4" />
<PackageVersion Include="Hiperspace.SQL" Version="2.4.4" />
<PackageReference Include="Hiperspace.SQL" />
paket add Hiperspace.SQL --version 2.4.4
#r "nuget: Hiperspace.SQL, 2.4.4"
#:package Hiperspace.SQL@2.4.4
#addin nuget:?package=Hiperspace.SQL&version=2.4.4
#tool nuget:?package=Hiperspace.SQL&version=2.4.4
Hiperspace.SQL
Hiperspace.SQL is a full SQL query engine for Hiperspace, supporting the full range of joins, aggregations, and subqueries.
Hiperspace.SQL provides the same query functionality as a .NET client can use with LINQ queries, but without the need to write code in C#/F#
Hiperspace fully supports point-in-time "time travel" queries that are not possible with Python Data-Frames or DuckDB
Features
- Hiperspace.SQL is not limited to queries of columns within a table, but supports the full navigation of properties of Hiperspace elements
- Where a column is a complex object it is returned as a JSON object
- Executing a batch of SQL statements return columnar data frames (dictionary of column-name and array of values)
- Explain SQL returns the execution plan, detailing the SetSPaces accessed and keys used for search (Key, Index, Scan)
- The Parquet method returns a Parquet file that can be used with any Apache Parquet library, or added to DuckDB OLAP store
Data Dictionary
SCHEMA_TABLE
Column Name | Data Type | Description |
---|---|---|
TABLE_NAME | string | The name of the table |
TABLE_TYPE | string | The type of the table in SCHEMA_PROPERTY |
SCHEMA_COLUMN
Column Name | Data Type | Description |
---|---|---|
TABLE_NAME | string | The name of the table |
COLUMN_NAME | string | The name of the column |
COLUMN_TYPE | string | The type of the table in SCHEMA_PROPERTY |
SCHEMA_PROPERTY
Column Name | Data Type | Description |
---|---|---|
TYPE_NAME | string | The Type Name |
PROPERTY_NAME | string | The name of each property |
PROPERTY_TYPE | string | reference to SCHEMA_PROPERTY.TYPE_NAME |
Examples
Simple query
SELECT p.Name, p.Gender FROM Persons as p WHERE p.Name = 'Lucy'
Query parameters
SELECT p.Name, p.Gender FROM Persons as p WHERE p.Name = :name
Query batches
SELECT p.Name, p.Gender FROM Persons as p WHERE p.Name = :name;
SELECT Name as name, Father as father from Persons ;
Joins
SELECT p.Name, f.Name as Father, f.Father as GrandFather
FROM Persons as p
join Persons as f on p.Father.Name = f.Name
WHERE p.Name = :name
Aggregates
select p.Father.Name, count(p.Name) as Children
from Persons as p
group by p.Father.Name as f
having count(*) > 1;
Like expressions
select p.Father.Name, count(p.Name) as Children
from Persons as p
where Name like 'L%' and Name like '%y' or (Name like '%u%' and Name like '_uc_')
group by p.Father.Name as f
having count(*) > 1;
Null handling
select p.Name, p.Father.Name
from Persons as p
where Name is not null
in query
SELECT p.Name, p.Gender
FROM Persons as p
WHERE p.Gender in (select p2.Gender from Persons as p2 where p2.Name = 'Lucy')
union
SELECT p.Name, p.Gender
FROM Persons as p
WHERE p.Name in ('Lucy', 'Mark')
union
SELECT p.Name, p.Gender
FROM Persons as p
WHERE p.Name in ('Eve', 'Mary')
inline view
SELECT p.Name, p.Gender
FROM Persons as p
join (select p2.Gender from Persons as p2 where p2.Name = 'Lucy') as p3 on p.Gender = p3.Gender
dictionary query
select * from SCHEMA_TABLES;
select * from SCHEMA_COLUMNS;
select * from SCHEMA_PROPERTIES;
API
The Hiperspace.SQL API can be called from any language that supports DOTNET interop, including Python (using pythonnet). Access via the Hiperspace.SQL.Engine object that is constructed with a reference to any domain space.
Explain
Provides a detailed breakdown of the query execution plan
member engine.Explain (source, parameters : IDictionary<string,obj>) : string array =
Execute
Executes the SQL queries and returns an array of Data Frames
member engine.Execute (source , parameters : IDictionary<string,obj>) : IDictionary<string, obj array> array =
Parquet
Executes the SQL queries will a n array of filenames (one for each statement) and returns the filenames after writing the results to the Apache Parquet files.
member this.Parquet (source, fileNames, parameters : IDictionary<string,obj>): string array =
Product | Versions 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 is compatible. 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. |
-
net8.0
- FSharp.Core (>= 9.0.303)
- FsLexYacc (>= 11.3.0)
- FsLexYacc.Runtime (>= 11.3.0)
- HiLang (>= 2.4.3)
- Hiperspace (>= 2.4.4)
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.CodeAnalysis (>= 4.14.0)
- Microsoft.CodeAnalysis.Analyzers (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Parquet.Net (>= 5.1.1)
- protobuf-net.Core (>= 3.2.56)
- System.CodeDom (>= 9.0.8)
- System.Text.Json (>= 9.0.8)
-
net9.0
- FSharp.Core (>= 9.0.303)
- FsLexYacc (>= 11.3.0)
- FsLexYacc.Runtime (>= 11.3.0)
- HiLang (>= 2.4.3)
- Hiperspace (>= 2.4.4)
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.CodeAnalysis (>= 4.14.0)
- Microsoft.CodeAnalysis.Analyzers (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Parquet.Net (>= 5.1.1)
- protobuf-net.Core (>= 3.2.56)
- System.CodeDom (>= 9.0.8)
- System.Text.Json (>= 9.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.4.4 | 166 | 8/7/2025 |
2.4.2 | 91 | 7/28/2025 |
2.4.0 | 136 | 7/10/2025 |
2.3.8 | 125 | 7/1/2025 |
2.3.4 | 139 | 6/5/2025 |
2.2.2 | 149 | 5/5/2025 |
2.2.1 | 212 | 4/14/2025 |
2.2.0 | 96 | 3/29/2025 |
2.1.9 | 219 | 3/5/2025 |
2.1.6 | 116 | 2/15/2025 |
2.0.0 | 72 | 1/14/2025 |
1.0.5 | 121 | 11/15/2024 |
1.0.2 | 109 | 11/1/2024 |
1.0.1 | 157 | 10/18/2024 |
https://www.cepheis.com/hiperspace/20250807
## Overview
Partition elimination is an advanced feature in SQL relational databases, that skip access to a partition view when the optimizer can determine that it will not return any values. This release adds the feature to Hiperspace views to skip `SetSpace` access that is not needed, *most commonly for Graph queries*
### SQL Views
```
/* for the view */
CREATE VIEW costs AS
SELECT cost, 'Sales' as area FROM sales_costs UNION
SELECT cost, 'Operations' as area FROM ops_costs UNION
SELECT cost, 'Assets' as area FROM asset_costs ;
/* queried as */
SELECT cost FROM costs WHERE area = 'Sales';
/* will skip the query ops_costs and asset_costs since it will return no rows */
```
### Hiperspace Views
Hiperspace views provide the same function, but rather than define a view separately, the view definition is part `element` definition, with the view being created as a union of all the `elements` { `entity`, `segment`, `aspect`, `view` } that provide the `view`.
```
segment Togaf.Has.Requirement : Togaf.Base
= Node ( SKey = SKey, Name = Name, TypeName = "AF-Requirement"),
Edges (From = owner, To = this, Name = Name, FromTypeName = "AF-Has-Requirement", ToTypeName = "AF-Requirement-For") ;
```
defines a `segment` named `Togaf.Has.Requirement` *that can be viewed* as a `Node` with the `TypeName` "AF-Requirement". Within the [TOGAF](https://github.com/channell/Hiperspace/blob/master/examples/TOGAF/TOGAF.hilang) sample there are
**201** elements that *can be viewed* as a `Node`, all of which are included in the `SubSpace` view `Nodes`.
Prior to this release a LINQ query `from node in Nodes where node.TypeName == "AF-Requirement";` would scan all **201** `SetSpace` before filtering to include only *requirements*, but will now skip the scan of the other **200** types. This is especially useful for graph data-explorer browsers that will typically search for a single source node type
This is implemented with the `SetSpace<>` function `public virtual bool IsSkippable(object template) => false;` that is overridden in **HiLang** generated code, and used by all `View` Sets
## RefSet<>
The `RefSet<>` collection of references to segments or other entities (via index) has been updated to include `AddAsync` to simplify the addition of a segment reference when used from a web-assembly client.