@sqlanvil/core 0.0.1 → 1.0.1

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/jit.proto ADDED
@@ -0,0 +1,186 @@
1
+ // Copyright 2023 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package sqlanvil;
18
+
19
+ import "google/protobuf/empty.proto";
20
+ import "google/protobuf/struct.proto";
21
+ import "google/protobuf/timestamp.proto";
22
+ import "core.proto";
23
+ import "db_adapter.proto";
24
+
25
+ // Database adapter, available in JiT compilation context.
26
+ service DbAdapter {
27
+ // Executes a query.
28
+ rpc Execute(ExecuteRequest) returns (ExecuteResponse) {}
29
+
30
+ // Lists table in schema.
31
+ rpc ListTables(ListTablesRequest) returns (ListTablesResponse) {}
32
+
33
+ // Gets table for target.
34
+ rpc GetTable(GetTableRequest) returns (TableMetadata) {}
35
+
36
+ // Drops table of specified target.
37
+ rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) {}
38
+ }
39
+
40
+ // Request to execute synchronous SQL query.
41
+ message ExecuteRequest {
42
+ // SQL statement query.
43
+ string statement = 1;
44
+ // Max rows to return in the job.
45
+ int64 row_limit = 2;
46
+ // Max bytes to process.
47
+ int64 byte_limit = 3;
48
+ // Whether or not fetch result rows.
49
+ bool fetch_results = 4;
50
+
51
+ BigQueryExecuteOptions big_query_options = 5;
52
+ // Query parameters for parameterized queries.
53
+ google.protobuf.Struct params = 6;
54
+ }
55
+
56
+ message BigQueryExecuteOptions {
57
+ // Priority - interactive if true or batch if false (default).
58
+ bool interactive = 1;
59
+ // See https://docs.cloud.google.com/bigquery/docs/reference/legacy-sql.
60
+ bool use_legacy_sql = 2;
61
+ // Labels to add to the job.
62
+ map<string, string> labels = 3;
63
+ // Location to execute the job at.
64
+ string location = 4;
65
+ // Job prefix to add.
66
+ string job_prefix = 5;
67
+ // Is dry run job.
68
+ bool dry_run = 6;
69
+ // BigQuery reservation to use for the job.
70
+ string reservation = 7;
71
+ }
72
+
73
+ // Synchronous execution response result.
74
+ message ExecuteResponse {
75
+ // Job metadata.
76
+ ExecutionMetadata execution_metadata = 1;
77
+ // Rows. For BigQuery, see
78
+ // https://docs.cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults.
79
+ repeated google.protobuf.Struct rows = 2;
80
+ repeated string errors = 3;
81
+ repeated Field schema_fields = 4;
82
+ }
83
+
84
+ // Request to list tables in schema.
85
+ message ListTablesRequest {
86
+ string database = 1;
87
+ string schema = 2;
88
+ }
89
+
90
+ // Tables metadata in schema.
91
+ message ListTablesResponse {
92
+ repeated TableMetadata tables = 1;
93
+ }
94
+
95
+ // Request to get table metadata for target.
96
+ message GetTableRequest {
97
+ Target target = 1;
98
+ }
99
+
100
+ // Request to drop the table for target.
101
+ message DeleteTableRequest {
102
+ Target target = 1;
103
+ }
104
+
105
+ // Execution information for introspection.
106
+ message RunningExecutionData {
107
+ // Targets that are being run in the current execution.
108
+ repeated Target run_targets = 1;
109
+ // ID of the current execution.
110
+ string execution_id = 2;
111
+ // Start time of the current execution.
112
+ google.protobuf.Timestamp execution_start_time = 3;
113
+ }
114
+
115
+ // JiT compilation target type.
116
+ enum JitCompilationTargetType {
117
+ // Unspecified - will result in error.
118
+ JIT_COMPILATION_TARGET_TYPE_UNSPECIFIED = 0;
119
+ // Table/view target.
120
+ JIT_COMPILATION_TARGET_TYPE_TABLE = 1;
121
+ // Operation target.
122
+ JIT_COMPILATION_TARGET_TYPE_OPERATION = 2;
123
+ // Incremental table target.
124
+ JIT_COMPILATION_TARGET_TYPE_INCREMENTAL_TABLE = 3;
125
+ // Assertion target.
126
+ JIT_COMPILATION_TARGET_TYPE_ASSERTION = 4;
127
+ }
128
+
129
+ // JiT compilation request.
130
+ message JitCompilationRequest {
131
+ // Canonical target being compiled.
132
+ Target target = 1;
133
+ // Canonical target dependencies.
134
+ repeated Target dependencies = 2;
135
+ // JiT code to compile.
136
+ string jit_code = 3;
137
+ // JiT data, exposed to code in context.
138
+ google.protobuf.Struct jit_data = 4;
139
+ // JiT compilation target type.
140
+ JitCompilationTargetType compilation_target_type = 5;
141
+ // List of additional file paths accessible at compilation.
142
+ repeated string file_paths = 6;
143
+ // Current execution information for introspection.
144
+ RunningExecutionData execution_data = 7;
145
+ }
146
+
147
+ // JiT compilation response.
148
+ message JitCompilationResponse {
149
+ oneof response {
150
+ JitTableResult table = 1;
151
+ JitOperationResult operation = 2;
152
+ JitIncrementalTableResult incremental_table = 3;
153
+ JitAssertionResult assertion = 4;
154
+ }
155
+ }
156
+
157
+ // JiT compilation result for table actions (including views).
158
+ // Fields match the Table message.
159
+ message JitTableResult {
160
+ // SQL Select query of the table.
161
+ string query = 1;
162
+ // Optional pre-operation statements.
163
+ repeated string pre_ops = 3;
164
+ // Optional post-operation statements.
165
+ repeated string post_ops = 4;
166
+ }
167
+
168
+ // JiT compilation result for incremental table actions.
169
+ message JitIncrementalTableResult {
170
+ // Fields match the Table message.
171
+ JitTableResult regular = 1;
172
+ // Fields match incremental_ fields in the Table message.
173
+ JitTableResult incremental = 2;
174
+ }
175
+
176
+ // JiT compilation result for operation actions.
177
+ message JitOperationResult {
178
+ // Sequence of SQL operations.
179
+ repeated string queries = 1;
180
+ }
181
+
182
+ // JiT compilation result for assertion actions.
183
+ message JitAssertionResult {
184
+ // SQL Select query that returns rows iff the assertion fails.
185
+ string query = 1;
186
+ }
package/package.json CHANGED
@@ -1,16 +1,41 @@
1
1
  {
2
- "name": "@sqlanvil/core",
3
- "version": "0.0.1",
4
- "description": "Placeholder for sqlanvil core — active development at https://github.com/ihistand/sqlanvil",
5
- "main": "index.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/ihistand/sqlanvil.git"
9
- },
10
- "homepage": "https://github.com/ihistand/sqlanvil",
11
- "author": "Ivan Histand",
12
- "license": "Apache-2.0",
13
- "publishConfig": {
14
- "access": "public"
15
- }
16
- }
2
+ "dependencies": {},
3
+ "resolutions": {
4
+ "**/object-path": "^0.11.5",
5
+ "**/http-proxy": "^1.18.1",
6
+ "**/serialize-javascript": "^3.1.0",
7
+ "**/ssri": "^7.1.1",
8
+ "**/glob-parent": "^5.1.2",
9
+ "**/node-forge": "^1.0.0",
10
+ "**/json-bigint": "^1.0.0",
11
+ "**/y18n": "^5.0.5",
12
+ "**/underscore": "^1.12.1",
13
+ "**/protobufjs": "^7.0.0",
14
+ "**/ansi-regex": "^3.0.1",
15
+ "**/json-schema": "^0.4.0",
16
+ "**/nth-check": "^2.0.1",
17
+ "**/node-fetch": "^2.6.7",
18
+ "**/markdown-it": "^12.3.2",
19
+ "**/wrap-ansi": "7.0.0",
20
+ "**/string-width": "4.1.0"
21
+ },
22
+ "homepage": "https://github.com/sqlanvil/sqlanvil",
23
+ "license": "Apache-2.0",
24
+ "keywords": [
25
+ "sqlanvil",
26
+ "etl",
27
+ "data-pipeline",
28
+ "big-data",
29
+ "data-modelling",
30
+ "sql",
31
+ "bigquery",
32
+ "dataops"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "version": "1.0.1",
38
+ "name": "@sqlanvil/core",
39
+ "description": "sqlanvil core API.",
40
+ "main": "bundle.js"
41
+ }
package/README.md DELETED
@@ -1,12 +0,0 @@
1
- # @sqlanvil/core
2
-
3
- **Status: placeholder. Not usable yet.**
4
-
5
- Core compiler library for [sqlanvil](https://github.com/ihistand/sqlanvil)
6
- — an open-source SQL workflow tool for BigQuery + PostgreSQL + Supabase,
7
- forked from Dataform's OSS core.
8
-
9
- This npm package name is reserved while the implementation matures.
10
- Watch the GitHub repo for the first usable release.
11
-
12
- License: Apache-2.0
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- console.error(
2
- "@sqlanvil/core is a placeholder. The library is not yet published.\n" +
3
- "Follow progress at https://github.com/ihistand/sqlanvil"
4
- );