All Downloads are FREE. Search and download functionalities are using the official Maven repository.

platform_store_relational.relationalRuntime.pure Maven / Gradle / Ivy

There is a newer version: 5.17.0
Show newest version
// Copyright 2021 Goldman Sachs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import meta::core::runtime::*;
import meta::pure::mapping::*;
import meta::external::store::relational::runtime::*;
import meta::relational::runtime::*;
import meta::relational::metamodel::relation::*;

Enum meta::relational::runtime::DatabaseType
{
   DB2, H2, MemSQL, Sybase, SybaseIQ, Composite, Postgres, SqlServer, Hive, Snowflake, Presto, Trino, BigQuery, Redshift, Databricks, Spanner, Athena, SparkSQL, DuckDB, DebugPrint
}

Class meta::external::store::relational::runtime::DatabaseConnection extends Connection
{
   type : meta::relational::runtime::DatabaseType[1];
   debug : Boolean[0..1];

   {doc.doc = 'Defaults to UTC'}
   timeZone : String[0..1];

   {doc.doc = 'Defaults to false'}
   quoteIdentifiers : Boolean[0..1];

   sqlQueryPostProcessors: Function<{SelectSQLQuery[1]->Result[1]}>[*];

   sqlQueryPostProcessorsConnectionAware: Function<{SelectSQLQuery[1],DatabaseConnection[1]->Result[1]}>[*];

   queryPostProcessors: PostProcessors[*];

   queryPostProcessorsWithParameter: PostProcessorWithParameter[*];
}

Class meta::relational::runtime::PostProcessorWithParameter
{
   postProcessor: ConcreteFunctionDefinition<{->PostProcessor[1]}>[1];

   parameters: PostProcessorParameter[*];
}

Class meta::relational::runtime::PostProcessorParameter
{

}

Class meta::relational::runtime::PostProcessor
{
   {doc.doc= 'Pure Execution flow'}
   sqlQueryPostProcessorForExecution: Function[0..1];

   {doc.doc= 'Plan Generation Flow'}
   sqlQueryPostProcessorForPlan: ConcreteFunctionDefinition[0..1];

   planPostProcessorId(){
        if($this.sqlQueryPostProcessorForPlan->size() == 1,|$this.sqlQueryPostProcessorForPlan->toOne()->elementToPath(),|[])
        }:String[0..1];

   executionPostProcessorId(){
       if($this.sqlQueryPostProcessorForExecution->size() == 1,|$this.sqlQueryPostProcessorForExecution->toOne()->elementToPath(),|[])
       }:String[0..1];

}

Class meta::relational::runtime::PostProcessors
{
   {doc.doc= 'Pure Execution flow'}
   sqlQueryPostProcessor: Function[0..1];

   {doc.doc= 'Plan Generation Flow'}
   _sqlQueryPostProcessor: Function[0..1];

   identifier : String[0..1];

   _sqlQueryPostProcessorId(){
        if($this._sqlQueryPostProcessor->size() == 1,|$this._sqlQueryPostProcessor->toOne()->elementToPath(),|[])
        }:String[0..1];

   sqlQueryPostProcessorId(){
       if($this.sqlQueryPostProcessor->size() == 1,|$this.sqlQueryPostProcessor->toOne()->elementToPath(),|[])
       }:String[0..1];

}

Class meta::external::store::relational::runtime::TestDatabaseConnection extends meta::external::store::relational::runtime::DatabaseConnection
{
    {doc.doc = 'This is used to generate SQL from the test data.'}
    testDataSetupCsv : String[0..1];
    // testDataSetupCsv should follow the following format -
    // 'default\n'+                                                               -> schema_name 
    // 'tradeTable\n'+                                                            -> table_name 
    // 'id, prodid, accountId, quantity, tradeDate, settlementDateTime\n'+        -> column_names separated by commas
    // '1,1,1,15,2014-12-01,'+$settlementDateTime+'\n'+                           -> rows separated by new line
    // '-\n'+                                                                     -> test data for different tables separated by - 
    // 'default\n'+                                                               -> schema_name 
    // 'tradeEventTable\n'+                                                       -> table_name 
    // 'event_id, trade_id, eventType, eventDate, person_id\n'+                   -> column_names separated by commas
    // '1,1,New,2014-12-01,1\n'+                                                  -> rows separated by new line
    // '\n\n\n'                                                                   -> test data end denoted by 

    {doc.doc = 'testDataSetupSqls field should never be populated manually. This is used exclusively in Legend Engine'}
    testDataSetupSqls : String[*];

    {doc.doc = 'testDataSchemas field should never be populated manually. This is used exclusively in Legend Engine'}
    testDataSchemas : meta::relational::metamodel::Schema[*];
}

Class meta::relational::runtime::DataSource
{
    host : String[1];
    port : Integer[1];
    name : String[1];
    type : meta::relational::runtime::DatabaseType[1];
    serverPrincipal: String[0..1];
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy