SQL
Flowtide has SQL support which will transform the SQL into a substrait plan which can then be run the engine.
To create a plan from SQL, add the following code to your application:
var sqlBuilder = new SqlPlanBuilder();
sqlBuilder.Sql(@"
CREATE TABLE testtable (
val any
);
INSERT INTO output
SELECT t.val FROM testtable t
");
var plan = sqlBuilder.GetPlan();
All SQL plans must have a source and a sink, so it must always insert to somewhere. The INSERT INTO denotes which output should leave the stream.
You can find more information in the following chapters:
📄️ Table Provider
It is possible to add table providers to the SqlPlanBuilder. These providers are called each time the compiler finds the usage of a table.
📄️ Create Table
The CREATE TABLE data definition is used to add metadata about a table to the SqlPlanBuilder.
📄️ Create View
The create view command allows you to define a reusable sub-plan.
🗃️ Select
4 items
📄️ Insert Into
The INSERT INTO statement is used to send data from the stream into a sink. Each stream requires at least one insert into statement to mark which data should be output from the stream.
📄️ Recursion
Flowtide also supports recusive queries, such as iterating over a tree structure. This is done with the WITH statement, and works similar as in other databases.