Skip to content

SQLQueryStringToPure Notes

Ephrim Stanley edited this page Feb 16, 2022 · 3 revisions

Notes

Database specific logic scattered throughout SQLQueryStringToPure

Example

   let specific = if ($dbType == DatabaseType.SybaseIQ,
                      | getLiteralProcessorsForSybaseIQ($dbTimeZone),
                      | if($dbType == DatabaseType.Sybase,
                           | getLiteralProcessorsForSybaseASE($dbTimeZone),
                            | if ($dbType == DatabaseType.Postgres,
                            | getLiteralProcessorsForPostgres($dbTimeZone),
                            | if ($dbType == DatabaseType.Presto,
                                 | getLiteralProcessorsForPresto($dbTimeZone),
                                 | newMap([]->cast(@Pair<Type, LiteralProcessor>))
                             ))));
function <<access.private>> meta::relational::functions::sqlQueryToString::databaseUsesTopForTake(dbType:DatabaseType[1]):Boolean[1]
{
   $dbType != DatabaseType.MemSQL && $dbType != DatabaseType.Postgres && $dbType != DatabaseType.DB2  && $dbType != DatabaseType.Snowflake && $dbType != DatabaseType.Presto && $dbType != DatabaseType.BigQuery && $dbType != DatabaseType.Databricks;
}

Do we need an abstract similar to DatabaseCommands in legend-engine that lets us plug in database specific behavior without making changes to SQLQueryStringToPure ?