Skip to content

Commit 290adda

Browse files
sqlite-mathematics-returns (#511)
Summary: - Improved CICD doco. - Migrated duplicate functionality to `any-sdk`. - Restore `sqlite3` mathematical functions. - Added robot test `Google Buckets List With Date Logic Exemplifies Use of SQLite Math Functions`.
1 parent 71f0c15 commit 290adda

File tree

8 files changed

+292
-51
lines changed

8 files changed

+292
-51
lines changed

docs/CICD.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Summary:
66

77
- At present, PR checks, build and test are all performed through [.github/workflows/build.yml](/.github/workflows/build.yml).
88
- Releasing over various channels (website, homebrew, chocolatey...) is performed manually.
9-
- ~~The strategic state is to split the functions: PR checks, build and test; into separate files, and migrate to use [goreleaser](https://goreleaser.com/).~~
109
- Docker Build and Push Jobs have scope for improvement.
1110
- These are currently based loosely on patterns described in:
1211
- https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
@@ -18,6 +17,10 @@ Summary:
1817
- **NOTE**: The QEMU build for linux/arm64 is **very slow**. On the order of 30 minutes. This is currently unavoidable.
1918
- **TODO**: Migrate linux/arm64 docker build to native once GHA supports this platform as a first class citizen.
2019
- **NOTE**. Be careful selecting from [the available github actions runners](https://github.com/actions/runner-images). Some runnner instances may be incompatible with assumed toolchain.
20+
- Docker images:
21+
- [production image at `stackql/stackql`](https://hub.docker.com/r/stackql/stackql/tags).
22+
- [development (zero guarantees) image at `stackql/stackql-devel`](https://hub.docker.com/r/stackql/stackql-devel/tags).
23+
2124

2225

2326
## Secrets

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/jackc/pgx/v5 v5.0.4
1313
github.com/lib/pq v1.10.4
1414
github.com/magiconair/properties v1.8.6
15-
github.com/mattn/go-sqlite3 v1.0.2-stackql
15+
github.com/mattn/go-sqlite3 v1.0.3-stackql
1616
github.com/olekukonko/tablewriter v0.0.0-20180130162743-b8a9be070da4
1717
github.com/sirupsen/logrus v1.9.0
1818
github.com/snowflakedb/gosnowflake v1.6.16
@@ -130,4 +130,4 @@ require (
130130

131131
replace github.com/chzyer/readline => github.com/stackql/readline v0.0.2-alpha05
132132

133-
replace github.com/mattn/go-sqlite3 => github.com/stackql/stackql-go-sqlite3 v1.0.2-stackql
133+
replace github.com/mattn/go-sqlite3 => github.com/stackql/stackql-go-sqlite3 v1.0.3-stackql

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ github.com/stackql/psql-wire v0.1.1-alpha07 h1:LQWVUlx4Bougk6dztDNG5tmXxpIVeeTSs
490490
github.com/stackql/psql-wire v0.1.1-alpha07/go.mod h1:a44Wd8kDC3irFLpGutarKDBqhJ/aqXlj1aMzO5bVJYg=
491491
github.com/stackql/readline v0.0.2-alpha05 h1:ID4QzGdplFBsrSnTuz8pvKzWw96JbrJg8fsLry2UriU=
492492
github.com/stackql/readline v0.0.2-alpha05/go.mod h1:OFAYOdXk/X4+5GYiDXFfaGrk+bCN6Qv0SYY5HNzD2E0=
493-
github.com/stackql/stackql-go-sqlite3 v1.0.2-stackql h1:HyctYfBzMth/fIs2Y+9c/SICsCvR/DEnzcI7VZgwGZo=
494-
github.com/stackql/stackql-go-sqlite3 v1.0.2-stackql/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
493+
github.com/stackql/stackql-go-sqlite3 v1.0.3-stackql h1:j0yt6T5thZuz5+HIr81PXz2AClAtCko0vzr5tm8C1g8=
494+
github.com/stackql/stackql-go-sqlite3 v1.0.3-stackql/go.mod h1:HemqCrcMK2xyhMMMt6oZ7ERDtoSmyyDsw5LBBcTZ+Rk=
495495
github.com/stackql/stackql-parser v0.0.14-alpha04 h1:CmZUDWf2jBbU+Zu3sdiuM5CwUBFGN/IFjzXPcu46xjs=
496496
github.com/stackql/stackql-parser v0.0.14-alpha04/go.mod h1:iyB47SvRS+Fvpn7joF7mHAkeiWSq83TbUhglRmLzPLQ=
497497
github.com/stackql/stackql-provider-registry v0.0.1-rc06 h1:MgroWOr0bSqjSTDGnXB0UoZGFXpW3SRtN0EFkzB8Rpo=

internal/stackql/internal_data_transfer/internaldto/exec_payload.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

internal/stackql/primitivegenerator/statement_analyzer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/stackql/any-sdk/anysdk"
1111
"github.com/stackql/any-sdk/pkg/constants"
1212
"github.com/stackql/any-sdk/pkg/dto"
13+
anysdk_internaldto "github.com/stackql/any-sdk/pkg/internaldto"
1314
"github.com/stackql/any-sdk/pkg/logging"
1415
"github.com/stackql/stackql/internal/stackql/astformat"
1516
"github.com/stackql/stackql/internal/stackql/astindirect"
@@ -599,7 +600,7 @@ func (pb *standardPrimitiveGenerator) AnalyzeUnaryExec(
599600
if err != nil && reqExists {
600601
return nil, err
601602
}
602-
var execPayload internaldto.ExecPayload
603+
var execPayload anysdk_internaldto.ExecPayload
603604
if node.OptExecPayload != nil {
604605
mediaType := "application/json" //nolint:goconst // acceptable for now
605606
if reqExists && req.GetBodyMediaType() != "" {
@@ -711,7 +712,7 @@ func (pb *standardPrimitiveGenerator) sanitiseMediaType(mediaType string) string
711712
func (pb *standardPrimitiveGenerator) parseExecPayload(
712713
node *sqlparser.ExecVarDef,
713714
payloadType string,
714-
) (internaldto.ExecPayload, error) {
715+
) (anysdk_internaldto.ExecPayload, error) {
715716
var b []byte
716717
m := make(map[string][]string)
717718
var pm map[string]interface{}
@@ -732,7 +733,7 @@ func (pb *standardPrimitiveGenerator) parseExecPayload(
732733
default:
733734
return nil, fmt.Errorf("payload map of declared type = '%T' not allowed", payloadType)
734735
}
735-
return internaldto.NewExecPayload(
736+
return anysdk_internaldto.NewExecPayload(
736737
b,
737738
m,
738739
pm,

test/python/flask/gcp/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
def log_request_info():
1313
logger.info(f"Request: {request.method} {request.path} - Query: {request.args}")
1414

15-
15+
@app.route('/b', methods=['GET'])
16+
def v1_storage_buckets_list():
17+
if request.args.get('project') == 'stackql-demo':
18+
return render_template('buckets-list.json'), 200, {'Content-Type': 'application/json'}
19+
return '{"msg": "Project Not Found"}', 404, {'Content-Type': 'application/json'}
1620

1721
@app.route('/v1/projects/testing-project-three/locations/global/keyRings/testing-three/cryptoKeys', methods=['GET'])
1822
def v1_projects_testing_project_three_locations_global_keyRings_testing_three_cryptoKeys():
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
{
2+
"kind": "storage#buckets",
3+
"items": [
4+
{
5+
"kind": "storage#bucket",
6+
"selfLink": "https://www.googleapis.com/storage/v1/b/demo-app-bucket1",
7+
"id": "demo-app-bucket1",
8+
"name": "demo-app-bucket1",
9+
"projectNumber": "0000000003",
10+
"generation": "0000000000001",
11+
"metageneration": "1",
12+
"location": "US",
13+
"storageClass": "STANDARD",
14+
"etag": "CAE=",
15+
"timeCreated": "2023-02-17T05:33:56.248Z",
16+
"updated": "2023-02-17T05:33:56.248Z",
17+
"labels": {
18+
"app": "stackql-demo-okta-app"
19+
},
20+
"softDeletePolicy": {
21+
"retentionDurationSeconds": "604800",
22+
"effectiveTime": "2024-03-01T08:00:00.000Z"
23+
},
24+
"iamConfiguration": {
25+
"bucketPolicyOnly": {
26+
"enabled": true,
27+
"lockedTime": "2023-05-18T05:33:56.248Z"
28+
},
29+
"uniformBucketLevelAccess": {
30+
"enabled": true,
31+
"lockedTime": "2023-05-18T05:33:56.248Z"
32+
},
33+
"publicAccessPrevention": "enforced"
34+
},
35+
"locationType": "multi-region",
36+
"rpo": "DEFAULT"
37+
},
38+
{
39+
"kind": "storage#bucket",
40+
"selfLink": "https://www.googleapis.com/storage/v1/b/demo-app-bucket2",
41+
"id": "demo-app-bucket2",
42+
"name": "demo-app-bucket2",
43+
"projectNumber": "0000000003",
44+
"generation": "0000000000001",
45+
"metageneration": "1",
46+
"location": "US",
47+
"storageClass": "STANDARD",
48+
"etag": "CAE=",
49+
"timeCreated": "2023-02-17T05:34:26.958Z",
50+
"updated": "2023-02-17T05:34:26.958Z",
51+
"labels": {
52+
"app": "stackql-demo-okta-app"
53+
},
54+
"softDeletePolicy": {
55+
"retentionDurationSeconds": "604800",
56+
"effectiveTime": "2024-03-01T08:00:00.000Z"
57+
},
58+
"iamConfiguration": {
59+
"bucketPolicyOnly": {
60+
"enabled": true,
61+
"lockedTime": "2023-05-18T05:34:26.958Z"
62+
},
63+
"uniformBucketLevelAccess": {
64+
"enabled": true,
65+
"lockedTime": "2023-05-18T05:34:26.958Z"
66+
},
67+
"publicAccessPrevention": "enforced"
68+
},
69+
"locationType": "multi-region",
70+
"rpo": "DEFAULT"
71+
},
72+
{
73+
"kind": "storage#bucket",
74+
"selfLink": "https://www.googleapis.com/storage/v1/b/stackql-demo-bucket",
75+
"id": "stackql-demo-bucket",
76+
"name": "stackql-demo-bucket",
77+
"projectNumber": "0000000003",
78+
"generation": "0000000000001",
79+
"metageneration": "1",
80+
"location": "US",
81+
"storageClass": "STANDARD",
82+
"etag": "CAE=",
83+
"timeCreated": "2022-02-09T04:39:09.058Z",
84+
"updated": "2022-02-09T04:39:09.058Z",
85+
"softDeletePolicy": {
86+
"retentionDurationSeconds": "604800",
87+
"effectiveTime": "2024-03-01T08:00:00.000Z"
88+
},
89+
"iamConfiguration": {
90+
"bucketPolicyOnly": {
91+
"enabled": false
92+
},
93+
"uniformBucketLevelAccess": {
94+
"enabled": false
95+
},
96+
"publicAccessPrevention": "inherited"
97+
},
98+
"locationType": "multi-region",
99+
"rpo": "DEFAULT"
100+
},
101+
{
102+
"kind": "storage#bucket",
103+
"selfLink": "https://www.googleapis.com/storage/v1/b/stackql-demo-src-bucket",
104+
"id": "stackql-demo-src-bucket",
105+
"name": "stackql-demo-src-bucket",
106+
"projectNumber": "0000000003",
107+
"generation": "0000000000001",
108+
"metageneration": "3",
109+
"location": "US",
110+
"storageClass": "STANDARD",
111+
"etag": "CAM=",
112+
"timeCreated": "2022-02-08T23:23:47.208Z",
113+
"updated": "2023-03-27T03:06:27.204Z",
114+
"softDeletePolicy": {
115+
"retentionDurationSeconds": "604800",
116+
"effectiveTime": "2024-03-01T08:00:00.000Z"
117+
},
118+
"iamConfiguration": {
119+
"bucketPolicyOnly": {
120+
"enabled": false
121+
},
122+
"uniformBucketLevelAccess": {
123+
"enabled": false
124+
},
125+
"publicAccessPrevention": "inherited"
126+
},
127+
"locationType": "multi-region",
128+
"rpo": "DEFAULT"
129+
},
130+
{
131+
"kind": "storage#bucket",
132+
"selfLink": "https://www.googleapis.com/storage/v1/b/stackql-demo.appspot.com",
133+
"id": "stackql-demo.appspot.com",
134+
"name": "stackql-demo.appspot.com",
135+
"projectNumber": "0000000003",
136+
"generation": "0000000000001",
137+
"metageneration": "1",
138+
"location": "US",
139+
"storageClass": "STANDARD",
140+
"etag": "CAE=",
141+
"timeCreated": "2023-02-26T08:35:40.061Z",
142+
"updated": "2023-02-26T08:35:40.061Z",
143+
"softDeletePolicy": {
144+
"retentionDurationSeconds": "604800",
145+
"effectiveTime": "2024-03-01T08:00:00.000Z"
146+
},
147+
"iamConfiguration": {
148+
"bucketPolicyOnly": {
149+
"enabled": false
150+
},
151+
"uniformBucketLevelAccess": {
152+
"enabled": false
153+
},
154+
"publicAccessPrevention": "inherited"
155+
},
156+
"locationType": "multi-region",
157+
"rpo": "DEFAULT"
158+
},
159+
{
160+
"kind": "storage#bucket",
161+
"selfLink": "https://www.googleapis.com/storage/v1/b/stackql-encrypted-bucket-1",
162+
"id": "stackql-encrypted-bucket-1",
163+
"name": "stackql-encrypted-bucket-1",
164+
"projectNumber": "0000000003",
165+
"generation": "0000000000001",
166+
"metageneration": "1",
167+
"location": "US",
168+
"storageClass": "STANDARD",
169+
"etag": "CAE=",
170+
"timeCreated": "2023-02-28T03:18:33.043Z",
171+
"updated": "2023-02-28T03:18:33.043Z",
172+
"encryption": {
173+
"defaultKmsKeyName": "projects/stackql-demo/locations/us/keyRings/stackql-us/cryptoKeys/stackql-us-demo-key"
174+
},
175+
"softDeletePolicy": {
176+
"retentionDurationSeconds": "604800",
177+
"effectiveTime": "2024-03-01T08:00:00.000Z"
178+
},
179+
"iamConfiguration": {
180+
"bucketPolicyOnly": {
181+
"enabled": true,
182+
"lockedTime": "2023-05-29T03:18:33.043Z"
183+
},
184+
"uniformBucketLevelAccess": {
185+
"enabled": true,
186+
"lockedTime": "2023-05-29T03:18:33.043Z"
187+
},
188+
"publicAccessPrevention": "enforced"
189+
},
190+
"locationType": "multi-region",
191+
"rpo": "DEFAULT"
192+
},
193+
{
194+
"kind": "storage#bucket",
195+
"selfLink": "https://www.googleapis.com/storage/v1/b/staging.stackql-demo.appspot.com",
196+
"id": "staging.stackql-demo.appspot.com",
197+
"name": "staging.stackql-demo.appspot.com",
198+
"projectNumber": "0000000003",
199+
"generation": "0000000000001",
200+
"metageneration": "1",
201+
"location": "US",
202+
"storageClass": "STANDARD",
203+
"etag": "CAE=",
204+
"timeCreated": "2023-02-26T08:35:40.223Z",
205+
"updated": "2023-02-26T08:35:40.223Z",
206+
"lifecycle": {
207+
"rule": [
208+
{
209+
"action": {
210+
"type": "Delete"
211+
},
212+
"condition": {
213+
"age": 15
214+
}
215+
}
216+
]
217+
},
218+
"softDeletePolicy": {
219+
"retentionDurationSeconds": "604800",
220+
"effectiveTime": "2024-03-01T08:00:00.000Z"
221+
},
222+
"iamConfiguration": {
223+
"bucketPolicyOnly": {
224+
"enabled": false
225+
},
226+
"uniformBucketLevelAccess": {
227+
"enabled": false
228+
},
229+
"publicAccessPrevention": "inherited"
230+
},
231+
"locationType": "multi-region",
232+
"rpo": "DEFAULT"
233+
}
234+
]
235+
}

0 commit comments

Comments
 (0)