semanticdb-v2 2.0.0-alpha.5 → 2.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +272 -7
- package/dist/cache/redis-query-cache.esm.js +1 -1
- package/dist/cache/redis-query-cache.js +1 -1
- package/dist/cache/types.d.ts +2 -0
- package/dist/executor/connection-registry.d.ts +1 -12
- package/dist/executor/execute-query.d.ts +6 -1
- package/dist/executor/federated-execution.d.ts +37 -0
- package/dist/executor/fetch-entities.d.ts +3 -1
- package/dist/executor/result-hydrator/types.d.ts +2 -0
- package/dist/executor/total.d.ts +11 -0
- package/dist/executor/types.d.ts +33 -4
- package/dist/index.d.ts +9 -7
- package/dist/logicform-types.d.ts +44 -12
- package/dist/normalizer/core.d.ts +9 -0
- package/dist/normalizer/pred-expression.d.ts +6 -0
- package/dist/operators/builtins/query-expression.d.ts +3 -0
- package/dist/operators/index.d.ts +1 -1
- package/dist/operators/types.d.ts +39 -8
- package/dist/physical/clickhouse-provider.d.ts +20 -2
- package/dist/physical/connection-registry.d.ts +13 -0
- package/dist/physical/connection.d.ts +57 -15
- package/dist/physical/dameng-provider.d.ts +66 -0
- package/dist/physical/databricks-provider.d.ts +88 -0
- package/dist/physical/db-connector.d.ts +23 -0
- package/dist/physical/display-query.d.ts +3 -0
- package/dist/physical/doris-provider.d.ts +2 -1
- package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
- package/dist/physical/gbase-provider.d.ts +11 -0
- package/dist/physical/index.d.ts +24 -9
- package/dist/physical/load-driver.d.ts +1 -0
- package/dist/physical/maxcompute-provider.d.ts +44 -0
- package/dist/physical/mysql-protocol-provider.d.ts +24 -6
- package/dist/physical/mysql-provider.d.ts +2 -1
- package/dist/physical/oracle-provider.d.ts +20 -4
- package/dist/physical/postgresql-provider.d.ts +23 -4
- package/dist/physical/provider.d.ts +57 -1
- package/dist/physical/snowflake-provider.d.ts +19 -3
- package/dist/physical/sqlserver-provider.d.ts +69 -0
- package/dist/physical/starrocks-provider.d.ts +2 -1
- package/dist/physical/table-description.d.ts +5 -0
- package/dist/physical/table-discovery.d.ts +10 -0
- package/dist/planner/build-lineage.d.ts +1 -1
- package/dist/planner/create-logical-plan.d.ts +7 -0
- package/dist/planner/index.d.ts +4 -2
- package/dist/planner/mapping-granularity.d.ts +7 -0
- package/dist/planner/rewrite-nested-components.d.ts +8 -0
- package/dist/planner/select-schema-mapping.d.ts +16 -2
- package/dist/planner/semantics/index.d.ts +0 -4
- package/dist/planner/semantics/periods.d.ts +13 -0
- package/dist/planner/semantics/registry-defaults.d.ts +2 -1
- package/dist/planner/types.d.ts +71 -34
- package/dist/plugins/hierarchy/index.d.ts +1 -1
- package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
- package/dist/plugins/hierarchy/types.d.ts +17 -0
- package/dist/plugins/index.d.ts +10 -1
- package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
- package/dist/plugins/observation/index.d.ts +17 -0
- package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +2 -3
- package/dist/{planner/semantics → plugins}/observation/periods.d.ts +2 -3
- package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
- package/dist/{planner/semantics → plugins}/observation/types.d.ts +1 -1
- package/dist/plugins/property-hierarchy/index.d.ts +11 -0
- package/dist/plugins/recursive/index.d.ts +26 -0
- package/dist/plugins/temporal/index.d.ts +13 -0
- package/dist/plugins/types.d.ts +165 -1
- package/dist/plugins/validity/classification.d.ts +5 -0
- package/dist/{planner/semantics → plugins}/validity/index.d.ts +9 -0
- package/dist/{planner/semantics → plugins}/validity/periods.d.ts +2 -3
- package/dist/{planner/semantics → plugins}/validity/query-policy.d.ts +1 -2
- package/dist/{planner/semantics → plugins}/validity/rule.d.ts +1 -1
- package/dist/plugins/validity/semantic-types.d.ts +3 -0
- package/dist/schema-mappings/freshness.d.ts +1 -1
- package/dist/schema-mappings/granularity.d.ts +5 -0
- package/dist/schema-mappings/index.d.ts +2 -1
- package/dist/schema-mappings/registry.d.ts +5 -3
- package/dist/schema-mappings/types.d.ts +43 -0
- package/dist/schema-mappings/yiask.d.ts +6 -2
- package/dist/semantic-types/index.d.ts +5 -3
- package/dist/semantic-types/registry.d.ts +2 -0
- package/dist/semantic-types/resolve-schema.d.ts +1 -1
- package/dist/semantic-types/types.d.ts +0 -14
- package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
- package/dist/semanticdb.esm.js +5 -3
- package/dist/semanticdb.js +5 -3
- package/package.json +46 -5
- package/dist/planner/semantics/annual-periods.d.ts +0 -11
- package/dist/planner/semantics/lifecycle/classification.d.ts +0 -5
- package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -2
- package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
- package/dist/planner/semantics/observation/index.d.ts +0 -6
- package/dist/planner/semantics/validity/classification.d.ts +0 -14
- package/dist/semantic-types/builtins/end-date.d.ts +0 -2
- package/dist/semantic-types/builtins/start-date.d.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -7,17 +7,19 @@ export declare const Logicform: Readonly<{
|
|
|
7
7
|
export { SemanticDBError } from './errors';
|
|
8
8
|
export { builtinSemanticTypes, createSemanticTypeRegistry, resolveSchema, SemanticTypeRegistry, validateResolvedSchema, } from './semantic-types/index';
|
|
9
9
|
export { builtinOperators, createOperatorRegistry, OperatorRegistry, resolveOperator, } from './operators/index';
|
|
10
|
-
export type { LegacySchemaPluginContext, SchemaMetadataPlugin, SemanticDBPlugin, } from './plugins/index';
|
|
10
|
+
export type { LegacySchemaPluginContext, MappingGranularityContext, MappingGranularityPlugin, OutputHandlerContext, OutputHandlerDefinition, IntervalSemanticProperties, IntervalSemanticsDefinition, PlannerPeriodDefinition, PlannerPeriodEvaluation, RelationSemanticsDefinition, RelationTemporalPlan, TimeWatermarkLogicformContext, PropertyMetadataPlugin, QueryOperatorCompileContext, QueryOperatorAuthorizeContext, QueryOperatorDefinition, QueryOperatorNormalizeContext, QueryOperatorPhysicalSource, QueryOperatorPlanContext, QueryOperatorPlanResult, SchemaMetadataPlugin, SchemaMappingPlugin, SemanticDBPlugin, } from './plugins/index';
|
|
11
11
|
export { SchemaMappingRegistry, fromYiAskSchemaMapping, } from './schema-mappings/index';
|
|
12
|
-
export type { AbsoluteDateValue, CompareOperator, CalendarDateValue, DateTimeValue, DateValue, EntityIdType, ExpressionItemType, LogicformType, PublicLogicformType, PeriodShiftTime, PredItemType, QueryLogicalOperand,
|
|
12
|
+
export type { AbsoluteDateValue, CompareOperator, DatePartQueryComparison, DatePartQueryOperand, CalendarDateValue, DateTimeValue, DateValue, EntityIdType, ExpressionItemType, LogicformType, NumericQueryComparison, NumericQueryOperand, PublicLogicformType, PeriodShiftTime, PredItemType, QueryLogicalOperand, QueryExpressionType, RelationQueryType, QueryType, QueryValueType, QueryValueTypeWithCompareOperator, RelativeDateValue, RepresentationType, } from './logicform-types';
|
|
13
|
+
export type { RecursiveQueryType } from './plugins/index';
|
|
13
14
|
export { CALENDAR_DATES_TABLE, CALENDAR_RELATIONS_TABLE, CALENDAR_SYSTEM_SCHEMA_IDS, calendarSystemSchemas, ProviderCalendarRelationStore, resolveCalendarPeriod, resolveCalendarPeriodFromStore, selectCalendarDates, } from './calendar/index';
|
|
14
15
|
export type { CalendarAlignment, CalendarComparison, CalendarDateRow, CalendarRelation, CalendarRelationRow, ResolvedCalendarPeriod, } from './calendar/index';
|
|
15
16
|
export type { CalendarRelationStore } from './calendar/index';
|
|
16
|
-
export type { PrimalType, PropertyHierarchyDefinition, PropertySqlDefinition, ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeNormalizeContext, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, SemanticTypeResultContext, SemanticTypeResultProperty,
|
|
17
|
-
export type {
|
|
18
|
-
export
|
|
19
|
-
export type {
|
|
20
|
-
export type {
|
|
17
|
+
export type { PrimalType, PropertyHierarchyDefinition, PropertySqlDefinition, ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeNormalizeContext, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, SemanticTypeResultContext, SemanticTypeResultProperty, TimeGranularity, TimeWatermarkPolicy, } from './semantic-types/index';
|
|
18
|
+
export type { DataRow, SqlParameters, BuiltinDatabaseConnection, DatabaseConnection, DatabaseConnectionBase, DatabaseConnectionExtensions, ProviderDefinition, ProviderKind, ProviderKindExtensions, } from './physical/index';
|
|
19
|
+
export { DBConnector, ProviderRegistry } from './physical/index';
|
|
20
|
+
export type { DBConnectorOptions, RunSQLOptions, GetTableListOptions, DescribeTableOptions, DescribeTableRequest, DatabaseColumn, TableDescription, DatabaseTable, SQLResult, TableListRequest, } from './physical/index';
|
|
21
|
+
export type { OperatorDefinition, OperatorDefaultNameContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorPlanInputContext, OperatorPlannedInput, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, ResultPropertyTemporalMetadataExtensions, } from './operators/index';
|
|
22
|
+
export type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingPredDefinition, SchemaMappingPredMatch, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, YiAskSchemaMappingItem, YiAskSchemaMappingRecord, } from './schema-mappings/index';
|
|
21
23
|
export type { QueryCache, QueryCacheExecutionOptions, QueryCacheIdentity, QueryCacheWriteOptions, } from './cache/index';
|
|
22
24
|
export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, PartialExecuteResult, ProgressCallback, } from './executor/index';
|
|
23
25
|
export type { ColumnPermissions, Permissions, SchemaPermissions, } from './permissions/index';
|
|
@@ -36,14 +36,9 @@ export type PeriodShiftTime = RelativeDateValue | AbsoluteDateValue;
|
|
|
36
36
|
export type DateValue = string | RelativeDateValue | AbsoluteDateValue | CalendarDateValue;
|
|
37
37
|
/** Stable entity identity. Numeric IDs must be safe integers. */
|
|
38
38
|
export type EntityIdType = string | number;
|
|
39
|
-
export type CompareOperator = '$eq' | '$gt' | '$gte' | '$lt' | '$lte' | '$ne' | '$in' | '$nin' | '$exists' | '$regex' | '$contains' | '$
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
readonly root?: QueryValueType;
|
|
43
|
-
readonly roots?: QueryValueType[];
|
|
44
|
-
readonly includeSelf?: boolean;
|
|
45
|
-
readonly idProperty?: string;
|
|
46
|
-
readonly parentProperty?: string;
|
|
39
|
+
export type CompareOperator = '$eq' | '$gt' | '$gte' | '$lt' | '$lte' | '$ne' | '$in' | '$nin' | '$exists' | '$regex' | '$contains' | '$startsWith' | '$length' | '$and' | '$or' | '$second' | '$minute' | '$hour' | '$weekday' | '$day' | '$week' | '$month' | '$quarter' | '$year' | Extract<keyof QueryOperatorExtensions, string>;
|
|
40
|
+
/** Module-augmentation seam for plugin-owned field Query Operators. */
|
|
41
|
+
export interface QueryOperatorExtensions {
|
|
47
42
|
}
|
|
48
43
|
export type QueryValueType = null | string | number | boolean | DateValue | RelationQueryType | LogicformType | string[] | number[] | boolean[] | DateValue[] | RelationQueryType[] | LogicformType[];
|
|
49
44
|
/** A query scoped through an object relation. Version is inherited from the parent LogicForm. */
|
|
@@ -55,6 +50,26 @@ export interface RelationQueryType {
|
|
|
55
50
|
readonly entity_id?: EntityIdType;
|
|
56
51
|
}
|
|
57
52
|
export type QueryLogicalOperand = QueryValueType | QueryValueTypeWithCompareOperator;
|
|
53
|
+
/** Apply a scalar pred expression, then test its result against a condition. */
|
|
54
|
+
export interface QueryExpressionType {
|
|
55
|
+
readonly pred: PredItemType;
|
|
56
|
+
readonly condition: QueryLogicalOperand;
|
|
57
|
+
}
|
|
58
|
+
export type NumericQueryOperand = number | number[] | NumericQueryComparison;
|
|
59
|
+
export type NumericQueryComparison = Partial<{
|
|
60
|
+
$eq: number;
|
|
61
|
+
$gt: number;
|
|
62
|
+
$gte: number;
|
|
63
|
+
$lt: number;
|
|
64
|
+
$lte: number;
|
|
65
|
+
$ne: number;
|
|
66
|
+
$in: number[];
|
|
67
|
+
$nin: number[];
|
|
68
|
+
$and: NumericQueryOperand[];
|
|
69
|
+
$or: NumericQueryOperand[];
|
|
70
|
+
}>;
|
|
71
|
+
export type DatePartQueryOperand = NumericQueryOperand;
|
|
72
|
+
export type DatePartQueryComparison = NumericQueryComparison;
|
|
58
73
|
export type QueryValueTypeWithCompareOperator = Partial<{
|
|
59
74
|
$eq: QueryValueType;
|
|
60
75
|
$gt: QueryValueType;
|
|
@@ -67,18 +82,32 @@ export type QueryValueTypeWithCompareOperator = Partial<{
|
|
|
67
82
|
$exists: QueryValueType;
|
|
68
83
|
$regex: QueryValueType;
|
|
69
84
|
$contains: QueryValueType;
|
|
85
|
+
$startsWith: string;
|
|
86
|
+
$length: NumericQueryOperand;
|
|
87
|
+
$second: DatePartQueryOperand;
|
|
88
|
+
$minute: DatePartQueryOperand;
|
|
89
|
+
$hour: DatePartQueryOperand;
|
|
90
|
+
/** ISO weekday: Monday=1 through Sunday=7. */
|
|
91
|
+
$weekday: DatePartQueryOperand;
|
|
92
|
+
/** Day of month. */
|
|
93
|
+
$day: DatePartQueryOperand;
|
|
94
|
+
/** ISO week of year. */
|
|
95
|
+
$week: DatePartQueryOperand;
|
|
96
|
+
$month: DatePartQueryOperand;
|
|
97
|
+
$quarter: DatePartQueryOperand;
|
|
98
|
+
$year: DatePartQueryOperand;
|
|
70
99
|
args?: {
|
|
71
100
|
readonly options?: string;
|
|
72
101
|
};
|
|
73
|
-
$recursive: QueryValueType | RecursiveQueryType;
|
|
74
102
|
$and: QueryLogicalOperand[];
|
|
75
103
|
$or: QueryLogicalOperand[];
|
|
76
|
-
}> & {
|
|
104
|
+
}> & Partial<QueryOperatorExtensions> & {
|
|
77
105
|
readonly schema?: never;
|
|
78
106
|
};
|
|
79
|
-
export type QueryType = Record<string, QueryValueType | QueryValueTypeWithCompareOperator | QueryType[] | undefined> & {
|
|
107
|
+
export type QueryType = Record<string, QueryValueType | QueryValueTypeWithCompareOperator | QueryExpressionType | QueryType[] | undefined> & {
|
|
80
108
|
readonly $and?: QueryType[];
|
|
81
109
|
readonly $or?: QueryType[];
|
|
110
|
+
readonly $expr?: QueryExpressionType;
|
|
82
111
|
};
|
|
83
112
|
export interface ExpressionItemType {
|
|
84
113
|
operator?: string;
|
|
@@ -92,7 +121,10 @@ export interface PredItemType extends ExpressionItemType {
|
|
|
92
121
|
pred?: string | PredItemType | (string | PredItemType)[];
|
|
93
122
|
query?: QueryType;
|
|
94
123
|
}
|
|
95
|
-
|
|
124
|
+
/** Module-augmentation seam for plugin-owned output types. */
|
|
125
|
+
export interface LogicformOutputExtensions {
|
|
126
|
+
}
|
|
127
|
+
export type LogicformOutputTypeValue = 'url' | 'data' | 'export' | 'sql' | 'sqlComponents' | Extract<keyof LogicformOutputExtensions, string>;
|
|
96
128
|
export interface LogicformOutputType {
|
|
97
129
|
type: LogicformOutputTypeValue;
|
|
98
130
|
filename?: string;
|
|
@@ -16,6 +16,15 @@ export interface NormalizeLogicformOptions {
|
|
|
16
16
|
readonly now?: Date;
|
|
17
17
|
readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
|
|
18
18
|
readonly requestTimeWatermark?: (schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty, requestedUpperBound: Date) => Promise<Date | undefined>;
|
|
19
|
+
readonly requestAutoCaseBounds?: (schema: ResolvedSemanticSchema, reference: string, query: LogicformType['query']) => Promise<{
|
|
20
|
+
readonly min: number;
|
|
21
|
+
readonly max: number;
|
|
22
|
+
readonly count: number;
|
|
23
|
+
} | {
|
|
24
|
+
readonly empty: true;
|
|
25
|
+
}>;
|
|
26
|
+
/** Internal root query used to resolve automatic `$case` boundaries. */
|
|
27
|
+
readonly autoCaseQuery?: LogicformType['query'];
|
|
19
28
|
readonly resolveFromSchema?: (normalizedFrom: LogicformType, outerSchema: ResolvedSemanticSchema) => ResolvedSemanticSchema;
|
|
20
29
|
readonly canProjectProperty?: (schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty) => boolean;
|
|
21
30
|
/** Internal recursion hook installed by normalizeLogicform. */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LogicformType, PredItemType } from '../logicform-types';
|
|
2
|
+
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
3
|
+
import type { NormalizeLogicformOptions } from './core';
|
|
4
|
+
type NormalizePredQuery = (query: LogicformType['query'], schema: ResolvedSemanticSchema, options: NormalizeLogicformOptions) => Promise<LogicformType['query']>;
|
|
5
|
+
export declare const normalizePredExpression: (pred: PredItemType, schema: ResolvedSemanticSchema, options: NormalizeLogicformOptions, normalizePredQuery: NormalizePredQuery) => Promise<PredItemType>;
|
|
6
|
+
export {};
|
|
@@ -3,6 +3,6 @@ import { OperatorRegistry } from './registry';
|
|
|
3
3
|
export { OperatorRegistry } from './registry';
|
|
4
4
|
export { resolveOperator } from './resolve';
|
|
5
5
|
export { bindTrustedSqlExpression } from './sql-expression';
|
|
6
|
-
export type { OperatorDefinition, OperatorDefaultNameContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext,
|
|
6
|
+
export type { OperatorDefinition, OperatorDefaultNameContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext, OperatorPeriodBoundaryPolicy, OperatorPeriodBoundaryPolicyContext, OperatorNormalizePredContext, OperatorPlanExpressionContext, OperatorPeriodEvaluationContext, OperatorPlanInputContext, OperatorPlannedInput, OperatorRewriteLogicformContext, OperatorValidatePlanContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, ResultPropertyTemporalMetadataExtensions, } from './types';
|
|
7
7
|
export declare const builtinOperators: readonly import("./types").OperatorDefinition[];
|
|
8
8
|
export declare const createOperatorRegistry: (plugins?: readonly SemanticDBPlugin[]) => OperatorRegistry;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PrimalType, ResolvedSemanticProperty, ResolvedSemanticSchema, TimeGranularity, ComparableCategoryDefinition } from '../semantic-types/index';
|
|
2
2
|
import type { LogicformType, PredItemType } from '../logicform-types';
|
|
3
3
|
import type { DataRow } from '../physical/index';
|
|
4
|
-
import type { Expression } from '../planner/index';
|
|
4
|
+
import type { Expression, LogicalPlan } from '../planner/index';
|
|
5
5
|
import type { LocaleTranslate } from '../i18n/index';
|
|
6
6
|
export interface OperatorSqlCapabilities {
|
|
7
7
|
/** Produce a dialect-specific aggregate function around an expression. */
|
|
@@ -10,6 +10,8 @@ export interface OperatorSqlCapabilities {
|
|
|
10
10
|
quoteIdentifier(identifier: string): string;
|
|
11
11
|
concat(expressions: readonly string[]): string;
|
|
12
12
|
substring(expression: string, start: number, length: number): string;
|
|
13
|
+
stringLength(expression: string): string;
|
|
14
|
+
datePart(expression: string, part: 'second' | 'minute' | 'hour' | 'weekday' | 'day' | 'week' | 'month' | 'quarter' | 'year'): string;
|
|
13
15
|
dateBucket(expression: string, granularity: TimeGranularity): string;
|
|
14
16
|
dateShift(expression: string, granularity: TimeGranularity, offset: number): string;
|
|
15
17
|
/** Render a period boundary directly when the dialect has a concise native form. */
|
|
@@ -46,6 +48,8 @@ export interface ResultProperty {
|
|
|
46
48
|
readonly type: string;
|
|
47
49
|
readonly primal_type: PrimalType;
|
|
48
50
|
readonly isArray: boolean;
|
|
51
|
+
/** Description inherited from the source Property or supplied by the operator. */
|
|
52
|
+
readonly description?: string;
|
|
49
53
|
/** Referenced Schema for object-valued result columns. */
|
|
50
54
|
readonly ref?: string;
|
|
51
55
|
readonly granularity?: TimeGranularity;
|
|
@@ -53,8 +57,11 @@ export interface ResultProperty {
|
|
|
53
57
|
/** Runtime temporal semantics for this output column, when applicable. */
|
|
54
58
|
readonly temporal?: ResultPropertyTemporalMetadata;
|
|
55
59
|
}
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
/** Plugin-owned result temporal metadata extends this interface by key. */
|
|
61
|
+
export interface ResultPropertyTemporalMetadataExtensions {
|
|
62
|
+
}
|
|
63
|
+
export type ResultPropertyTemporalMetadata = {
|
|
64
|
+
readonly kind: 'period-boundary' | 'period-shift' | 'date-bucket';
|
|
58
65
|
readonly boundary?: 'start' | 'end';
|
|
59
66
|
readonly sourceProperty?: string;
|
|
60
67
|
readonly requestedRange?: {
|
|
@@ -74,7 +81,7 @@ export interface ResultPropertyTemporalMetadata {
|
|
|
74
81
|
readonly group: Readonly<Record<string, unknown>>;
|
|
75
82
|
readonly date: string;
|
|
76
83
|
}[];
|
|
77
|
-
}
|
|
84
|
+
} | ResultPropertyTemporalMetadataExtensions[keyof ResultPropertyTemporalMetadataExtensions];
|
|
78
85
|
export interface OperatorOutputPropertyContext {
|
|
79
86
|
/** Final alias assigned to this operator's single output column. */
|
|
80
87
|
readonly name: string;
|
|
@@ -135,10 +142,10 @@ export interface OperatorPlanExpressionContext {
|
|
|
135
142
|
readonly getOperator: (name: string) => OperatorDefinition;
|
|
136
143
|
readonly planQuery: (query: Readonly<Record<string, unknown>>) => Readonly<Record<string, unknown>>;
|
|
137
144
|
}
|
|
138
|
-
export interface
|
|
145
|
+
export interface OperatorPeriodBoundaryPolicyContext {
|
|
139
146
|
readonly pred: PredItemType;
|
|
140
147
|
}
|
|
141
|
-
export interface
|
|
148
|
+
export interface OperatorPeriodBoundaryPolicy {
|
|
142
149
|
readonly boundary: 'start' | 'end';
|
|
143
150
|
readonly implicit: boolean;
|
|
144
151
|
}
|
|
@@ -148,6 +155,9 @@ export interface OperatorValidatePlanContext {
|
|
|
148
155
|
readonly resolveGroupName: (reference: string) => string | undefined;
|
|
149
156
|
readonly getOperator: (name: string) => OperatorDefinition;
|
|
150
157
|
}
|
|
158
|
+
export interface OperatorValidateGroupbyContext {
|
|
159
|
+
readonly pred: PredItemType;
|
|
160
|
+
}
|
|
151
161
|
export interface OperatorRewriteLogicformContext {
|
|
152
162
|
readonly logicform: LogicformType;
|
|
153
163
|
readonly schema: ResolvedSemanticSchema;
|
|
@@ -222,8 +232,23 @@ export type OperatorExecutionComponent = OperatorQueryComponent | OperatorCompon
|
|
|
222
232
|
interface OperatorDefinitionBase {
|
|
223
233
|
/** Public registry key. Built-in operators commonly use a `$` prefix, but it is not required. */
|
|
224
234
|
readonly name: string;
|
|
235
|
+
/** Description of the computed metric, exposed on its result Property. */
|
|
236
|
+
readonly description?: string;
|
|
225
237
|
/** Produce the normalized output name when the PredItem does not declare one. */
|
|
226
238
|
readonly defaultName: (context: OperatorDefaultNameContext) => string;
|
|
239
|
+
/** Translation key for the generated name. Defaults to `operator.${name}`. */
|
|
240
|
+
readonly defaultNameKey?: string | ((context: OperatorDefaultNameContext) => string);
|
|
241
|
+
/** defaultName already used the translator and must not be translated a second time. */
|
|
242
|
+
readonly defaultNameIsLocalized?: boolean;
|
|
243
|
+
/** A grouped physical source may safely apply this operator again to stored partial results. */
|
|
244
|
+
readonly supportsGroupedSourceRollup?: boolean;
|
|
245
|
+
/** This computed operator preserves a grouped physical source's dimension semantics. */
|
|
246
|
+
readonly supportsGroupedSourceGroupby?: boolean;
|
|
247
|
+
/** Requested time grain of a grouped dimension, when this is a time grouping operator. */
|
|
248
|
+
readonly groupedSourceTimeGranularity?: (context: {
|
|
249
|
+
readonly pred: PredItemType;
|
|
250
|
+
readonly property: ResolvedSemanticProperty;
|
|
251
|
+
}) => TimeGranularity | undefined;
|
|
227
252
|
/** Logical property names read in addition to the direct input property. */
|
|
228
253
|
readonly dependencies?: readonly string[];
|
|
229
254
|
/** Set to false for operators such as `$count` that do not require a property. */
|
|
@@ -236,10 +261,16 @@ interface OperatorDefinitionBase {
|
|
|
236
261
|
readonly normalizePred?: (context: OperatorNormalizePredContext) => PredItemType;
|
|
237
262
|
/** Build a provider-independent expression for operators with custom planning semantics. */
|
|
238
263
|
readonly planExpression?: (context: OperatorPlanExpressionContext) => Expression | undefined;
|
|
239
|
-
/**
|
|
240
|
-
readonly
|
|
264
|
+
/** Describe how this operator selects a value at a generated period boundary. */
|
|
265
|
+
readonly periodBoundaryPolicy?: (context: OperatorPeriodBoundaryPolicyContext) => OperatorPeriodBoundaryPolicy | undefined;
|
|
241
266
|
/** Validate this operator against the completed group key set. */
|
|
242
267
|
readonly validatePlan?: (context: OperatorValidatePlanContext) => void;
|
|
268
|
+
/** Validate semantics that apply only when this Operator is used as a group key. */
|
|
269
|
+
readonly validateGroupby?: (context: OperatorValidateGroupbyContext) => void;
|
|
270
|
+
/** The logical planner may fully lower a component, so no executor child query is needed. */
|
|
271
|
+
readonly skipComponentExecution?: (context: {
|
|
272
|
+
readonly plan: LogicalPlan;
|
|
273
|
+
}) => boolean;
|
|
243
274
|
/** Expand high-level operator semantics into ordinary nested LogicForm objects before planning. */
|
|
244
275
|
readonly rewriteLogicform?: (context: OperatorRewriteLogicformContext) => LogicformType | undefined;
|
|
245
276
|
/** Whether this operator requires one evaluation per time bucket. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
2
|
interface ClickHouseResultLike {
|
|
3
3
|
json<T>(): Promise<T>;
|
|
4
4
|
}
|
|
@@ -9,6 +9,17 @@ export interface ClickHouseClientLike {
|
|
|
9
9
|
query_params: Readonly<Record<string, unknown>>;
|
|
10
10
|
abort_signal?: AbortSignal;
|
|
11
11
|
}): Promise<ClickHouseResultLike>;
|
|
12
|
+
/** Native SDK exec does not append a FORMAT clause to commands. */
|
|
13
|
+
exec?(options: {
|
|
14
|
+
query: string;
|
|
15
|
+
query_params: Readonly<Record<string, unknown>>;
|
|
16
|
+
clickhouse_settings: {
|
|
17
|
+
readonly default_format: 'JSONEachRow';
|
|
18
|
+
};
|
|
19
|
+
abort_signal?: AbortSignal;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
readonly stream: AsyncIterable<string | Buffer>;
|
|
22
|
+
}>;
|
|
12
23
|
close(): Promise<void>;
|
|
13
24
|
}
|
|
14
25
|
export interface ClickHouseProviderOptions {
|
|
@@ -25,8 +36,10 @@ export interface ClickHouseProviderOptions {
|
|
|
25
36
|
readonly client?: ClickHouseClientLike;
|
|
26
37
|
}
|
|
27
38
|
export declare class ClickHouseProvider implements CoreComputeProvider {
|
|
39
|
+
#private;
|
|
28
40
|
readonly kind: "clickhouse";
|
|
29
|
-
|
|
41
|
+
readonly supportsRecursiveCte = true;
|
|
42
|
+
readonly recursiveCteUnion: "UNION ALL";
|
|
30
43
|
constructor(options?: ClickHouseProviderOptions);
|
|
31
44
|
quoteIdentifier(identifier: string): string;
|
|
32
45
|
tableAlias(expression: string, alias: string): string;
|
|
@@ -34,6 +47,7 @@ export declare class ClickHouseProvider implements CoreComputeProvider {
|
|
|
34
47
|
parameter(index: number, value: unknown): string;
|
|
35
48
|
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
36
49
|
dateBucket(expression: string, level: string): string;
|
|
50
|
+
datePart(expression: string, part: DatePart): string;
|
|
37
51
|
dateShift(expression: string, granularity: string, offset: number): string;
|
|
38
52
|
castValue(expression: string, type: string): string;
|
|
39
53
|
scalarExtremum(operator: 'least' | 'greatest', expressions: readonly string[]): string;
|
|
@@ -41,6 +55,7 @@ export declare class ClickHouseProvider implements CoreComputeProvider {
|
|
|
41
55
|
stringify(expression: string): string;
|
|
42
56
|
concat(expressions: readonly string[]): string;
|
|
43
57
|
substring(expression: string, start: number, length: number): string;
|
|
58
|
+
stringLength(expression: string): string;
|
|
44
59
|
regex(expression: string, pattern: string, options?: string): string;
|
|
45
60
|
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
46
61
|
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
@@ -48,6 +63,9 @@ export declare class ClickHouseProvider implements CoreComputeProvider {
|
|
|
48
63
|
valueExpression: string;
|
|
49
64
|
};
|
|
50
65
|
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
66
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
67
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
68
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
51
69
|
close(): Promise<void>;
|
|
52
70
|
}
|
|
53
71
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DatabaseConnection, ProviderRegistry } from './connection';
|
|
2
|
+
import type { CoreComputeProvider } from './provider';
|
|
3
|
+
type ProviderFactory = (connection: DatabaseConnection) => CoreComputeProvider;
|
|
4
|
+
export declare class ConnectionRegistry {
|
|
5
|
+
#private;
|
|
6
|
+
private readonly create;
|
|
7
|
+
constructor(create?: ProviderFactory);
|
|
8
|
+
get(connection: DatabaseConnection): CoreComputeProvider;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const getConnectionProvider: (connection: DatabaseConnection, providers?: ProviderRegistry) => CoreComputeProvider;
|
|
12
|
+
export declare const closeConnections: () => Promise<void>;
|
|
13
|
+
export {};
|
|
@@ -1,32 +1,74 @@
|
|
|
1
1
|
import type { CoreComputeProvider } from './provider';
|
|
2
2
|
import type { ClickHouseProviderOptions } from './clickhouse-provider';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import type { DatabricksConnectionOptions } from './databricks-provider';
|
|
4
|
+
import type { DamengConnectionOptions } from './dameng-provider';
|
|
5
|
+
import type { DorisConnectionOptions } from './doris-provider';
|
|
6
|
+
import type { GBaseConnectionOptions } from './gbase-provider';
|
|
7
|
+
import type { MaxComputeConnectionOptions } from './maxcompute-provider';
|
|
8
|
+
import type { MySQLConnectionOptions } from './mysql-provider';
|
|
9
|
+
import type { OracleConnectionOptions } from './oracle-provider';
|
|
10
|
+
import type { PostgreSQLConnectionOptions } from './postgresql-provider';
|
|
11
|
+
import type { SnowflakeConnectionOptions } from './snowflake-provider';
|
|
12
|
+
import type { SQLServerConnectionOptions } from './sqlserver-provider';
|
|
13
|
+
import type { StarRocksConnectionOptions } from './starrocks-provider';
|
|
14
|
+
export interface DatabaseConnectionBase {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly kind: string;
|
|
17
|
+
}
|
|
18
|
+
/** Module-augmentation seam for application-owned connection kinds. */
|
|
19
|
+
export interface DatabaseConnectionExtensions {
|
|
20
|
+
}
|
|
21
|
+
export type BuiltinDatabaseConnection = ({
|
|
11
22
|
readonly id: string;
|
|
12
23
|
readonly kind: 'mysql';
|
|
13
|
-
} &
|
|
24
|
+
} & MySQLConnectionOptions) | ({
|
|
14
25
|
readonly id: string;
|
|
15
26
|
readonly kind: 'doris';
|
|
16
|
-
} &
|
|
27
|
+
} & DorisConnectionOptions) | ({
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly kind: 'gbase';
|
|
30
|
+
} & GBaseConnectionOptions) | ({
|
|
17
31
|
readonly id: string;
|
|
18
32
|
readonly kind: 'starrocks';
|
|
19
|
-
} &
|
|
33
|
+
} & StarRocksConnectionOptions) | ({
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly kind: 'maxcompute';
|
|
36
|
+
} & MaxComputeConnectionOptions) | ({
|
|
20
37
|
readonly id: string;
|
|
21
38
|
readonly kind: 'postgresql';
|
|
22
|
-
} &
|
|
39
|
+
} & PostgreSQLConnectionOptions) | ({
|
|
23
40
|
readonly id: string;
|
|
24
41
|
readonly kind: 'clickhouse';
|
|
25
42
|
} & Omit<ClickHouseProviderOptions, 'client'>) | ({
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly kind: 'databricks';
|
|
45
|
+
} & DatabricksConnectionOptions) | ({
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly kind: 'dameng';
|
|
48
|
+
} & DamengConnectionOptions) | ({
|
|
26
49
|
readonly id: string;
|
|
27
50
|
readonly kind: 'snowflake';
|
|
28
|
-
} &
|
|
51
|
+
} & SnowflakeConnectionOptions) | ({
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly kind: 'sqlserver';
|
|
54
|
+
} & SQLServerConnectionOptions) | ({
|
|
29
55
|
readonly id: string;
|
|
30
56
|
readonly kind: 'oracle';
|
|
31
|
-
} &
|
|
32
|
-
|
|
57
|
+
} & OracleConnectionOptions);
|
|
58
|
+
type ExtendedDatabaseConnection = DatabaseConnectionExtensions[keyof DatabaseConnectionExtensions];
|
|
59
|
+
export type DatabaseConnection = BuiltinDatabaseConnection | ExtendedDatabaseConnection;
|
|
60
|
+
export interface ProviderDefinition<Connection extends DatabaseConnectionBase = DatabaseConnectionBase> {
|
|
61
|
+
readonly kind: Connection['kind'];
|
|
62
|
+
readonly create: (connection: Connection) => CoreComputeProvider;
|
|
63
|
+
}
|
|
64
|
+
export declare const builtinProviderDefinitions: readonly ProviderDefinition[];
|
|
65
|
+
export declare class ProviderRegistry {
|
|
66
|
+
#private;
|
|
67
|
+
constructor(definitions?: readonly ProviderDefinition[]);
|
|
68
|
+
register<Connection extends DatabaseConnectionBase>(definition: ProviderDefinition<Connection>): this;
|
|
69
|
+
create(connection: DatabaseConnectionBase): CoreComputeProvider;
|
|
70
|
+
has(kind: string): boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare const defaultProviderRegistry: ProviderRegistry;
|
|
73
|
+
export declare const createProvider: (connection: DatabaseConnection, providers?: ProviderRegistry) => CoreComputeProvider;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
type DamengBind = string | number | Date | Buffer | null;
|
|
3
|
+
export interface DamengConnectionOptions {
|
|
4
|
+
readonly connectString?: string;
|
|
5
|
+
readonly host?: string;
|
|
6
|
+
readonly port?: number;
|
|
7
|
+
readonly user?: string;
|
|
8
|
+
readonly password?: string;
|
|
9
|
+
readonly schema?: string;
|
|
10
|
+
readonly poolMin?: number;
|
|
11
|
+
readonly poolMax?: number;
|
|
12
|
+
readonly poolTimeout?: number;
|
|
13
|
+
readonly [option: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface DamengConnectionLike {
|
|
16
|
+
execute(sql: string, binds: DamengBind[], options: {
|
|
17
|
+
readonly outFormat: number;
|
|
18
|
+
readonly autoCommit?: boolean;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
readonly rows?: unknown[];
|
|
21
|
+
readonly rowsAffected?: number;
|
|
22
|
+
}>;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface DamengPoolLike {
|
|
26
|
+
getConnection(): Promise<DamengConnectionLike>;
|
|
27
|
+
close(drainTime?: number): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface DamengDriverLike {
|
|
30
|
+
createPool(options: DamengPoolOptions): Promise<DamengPoolLike>;
|
|
31
|
+
}
|
|
32
|
+
export interface DamengPoolOptions extends Omit<DamengConnectionOptions, 'host' | 'port'> {
|
|
33
|
+
readonly connectString: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DamengProviderOptions {
|
|
36
|
+
readonly connection?: DamengConnectionOptions;
|
|
37
|
+
readonly pool?: DamengPoolLike;
|
|
38
|
+
readonly driver?: DamengDriverLike;
|
|
39
|
+
}
|
|
40
|
+
export declare const damengPoolOptions: (options: DamengConnectionOptions) => DamengPoolOptions;
|
|
41
|
+
export declare class DamengProvider implements CoreComputeProvider {
|
|
42
|
+
#private;
|
|
43
|
+
readonly kind: "dameng";
|
|
44
|
+
readonly supportsHavingAlias = false;
|
|
45
|
+
constructor(options?: DamengProviderOptions);
|
|
46
|
+
quoteIdentifier(identifier: string): string;
|
|
47
|
+
tableAlias(expression: string, alias: string): string;
|
|
48
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
49
|
+
parameter(index: number, value: unknown): string;
|
|
50
|
+
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
51
|
+
dateBucket(expression: string, level: string): string;
|
|
52
|
+
datePart(expression: string, part: DatePart): string;
|
|
53
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
54
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
55
|
+
stringify(expression: string): string;
|
|
56
|
+
concat(expressions: readonly string[]): string;
|
|
57
|
+
substring(expression: string, start: number, length: number): string;
|
|
58
|
+
stringLength(expression: string): string;
|
|
59
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
60
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
61
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
62
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
63
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
64
|
+
close(): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
type DatabricksBind = string | number | boolean | bigint | Date | null;
|
|
3
|
+
export interface DatabricksConnectionBase {
|
|
4
|
+
readonly host: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly catalog?: string;
|
|
7
|
+
readonly schema?: string;
|
|
8
|
+
/** Legacy datasource field for the default schema. */
|
|
9
|
+
readonly database?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DatabricksAccessTokenAuth {
|
|
12
|
+
readonly authType: 'access-token';
|
|
13
|
+
readonly token: string;
|
|
14
|
+
readonly oauthClientId?: never;
|
|
15
|
+
readonly oauthClientSecret?: never;
|
|
16
|
+
readonly azureTenantId?: never;
|
|
17
|
+
readonly useDatabricksOAuthInAzure?: never;
|
|
18
|
+
readonly oauthScopes?: never;
|
|
19
|
+
}
|
|
20
|
+
export interface DatabricksOAuthAuth {
|
|
21
|
+
readonly authType: 'databricks-oauth';
|
|
22
|
+
readonly oauthClientId: string;
|
|
23
|
+
readonly oauthClientSecret: string;
|
|
24
|
+
readonly token?: never;
|
|
25
|
+
readonly azureTenantId?: string;
|
|
26
|
+
readonly useDatabricksOAuthInAzure?: boolean;
|
|
27
|
+
readonly oauthScopes?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
export type DatabricksConnectionOptions = DatabricksConnectionBase & (DatabricksAccessTokenAuth | DatabricksOAuthAuth);
|
|
30
|
+
export interface DatabricksOperationLike {
|
|
31
|
+
fetchAll(): Promise<unknown>;
|
|
32
|
+
/** The native SDK can finish commands that have no result set to fetch. */
|
|
33
|
+
finished?(): Promise<void>;
|
|
34
|
+
cancel(): Promise<unknown>;
|
|
35
|
+
close(): Promise<unknown>;
|
|
36
|
+
}
|
|
37
|
+
export interface DatabricksSessionLike {
|
|
38
|
+
executeStatement(sql: string, options: {
|
|
39
|
+
readonly ordinalParameters: DatabricksBind[];
|
|
40
|
+
}): Promise<DatabricksOperationLike>;
|
|
41
|
+
close(): Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface DatabricksClientLike {
|
|
44
|
+
connect(options: object): Promise<unknown>;
|
|
45
|
+
openSession(options: {
|
|
46
|
+
readonly initialCatalog?: string;
|
|
47
|
+
readonly initialSchema?: string;
|
|
48
|
+
}): Promise<DatabricksSessionLike>;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export interface DatabricksProviderOptions {
|
|
52
|
+
readonly connection?: DatabricksConnectionOptions;
|
|
53
|
+
readonly client?: DatabricksClientLike;
|
|
54
|
+
}
|
|
55
|
+
export declare const databricksConnectOptions: (input: unknown) => object;
|
|
56
|
+
export declare class DatabricksProvider implements CoreComputeProvider {
|
|
57
|
+
#private;
|
|
58
|
+
readonly kind: "databricks";
|
|
59
|
+
readonly supportsHavingAlias = false;
|
|
60
|
+
readonly supportsRecursiveCte = true;
|
|
61
|
+
constructor(options?: DatabricksProviderOptions);
|
|
62
|
+
quoteIdentifier(identifier: string): string;
|
|
63
|
+
tableAlias(expression: string, alias: string): string;
|
|
64
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
65
|
+
parameter(index: number, value: unknown): string;
|
|
66
|
+
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
67
|
+
dateBucket(expression: string, level: string): string;
|
|
68
|
+
datePart(expression: string, part: DatePart): string;
|
|
69
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
70
|
+
castValue(expression: string, type: string): string;
|
|
71
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
72
|
+
stringify(expression: string): string;
|
|
73
|
+
concat(expressions: readonly string[]): string;
|
|
74
|
+
substring(expression: string, start: number, length: number): string;
|
|
75
|
+
stringLength(expression: string): string;
|
|
76
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
77
|
+
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
78
|
+
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
79
|
+
joinSql: string;
|
|
80
|
+
valueExpression: string;
|
|
81
|
+
};
|
|
82
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
83
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
84
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
85
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
86
|
+
close(): Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DatabaseConnection, ProviderRegistry } from './connection';
|
|
2
|
+
import type { DatabaseTable, SQLResult, SqlParameters, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
3
|
+
export interface DBConnectorOptions {
|
|
4
|
+
/** Exactly the same connection object accepted by Logicform.execute.connections. */
|
|
5
|
+
readonly connection: DatabaseConnection;
|
|
6
|
+
readonly providerRegistry?: ProviderRegistry;
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export interface RunSQLOptions extends DBConnectorOptions {
|
|
10
|
+
readonly sql: string;
|
|
11
|
+
readonly parameters?: SqlParameters;
|
|
12
|
+
}
|
|
13
|
+
export interface GetTableListOptions extends DBConnectorOptions, TableListRequest {
|
|
14
|
+
}
|
|
15
|
+
export interface DescribeTableOptions extends DBConnectorOptions, DescribeTableRequest {
|
|
16
|
+
}
|
|
17
|
+
/** Trusted physical operations; no LogicForm permissions, rewriting, or caching. */
|
|
18
|
+
export declare const DBConnector: Readonly<{
|
|
19
|
+
runSQL: (options: RunSQLOptions) => Promise<SQLResult>;
|
|
20
|
+
getTableList: (options: GetTableListOptions) => Promise<DatabaseTable[]>;
|
|
21
|
+
describeTable: (options: DescribeTableOptions) => Promise<TableDescription>;
|
|
22
|
+
close: () => Promise<void>;
|
|
23
|
+
}>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const displayClickHouseQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
2
2
|
export declare const displayOracleQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
3
3
|
export declare const displayPostgreSQLQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
4
|
+
export declare const displayMySQLQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
4
5
|
export declare const displayQuestionMarkQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
6
|
+
export declare const displayDamengQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
7
|
+
export declare const displaySQLServerQuery: (sql: string, parameters: readonly unknown[]) => string;
|