Skip to content

Commit 87e57d9

Browse files
materialized-view-enhancement (#517)
Summary: - Support for materialized views which contain double quotes `"`. - Supported for both `sqlite` and `postgres`. - Added robot test `AWS Materialized View And Query on Resource Costs Exemplifies Functions On Materialized Views`.
1 parent fab98c5 commit 87e57d9

File tree

11 files changed

+7945
-2
lines changed

11 files changed

+7945
-2
lines changed

docs/auth.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ Having done this, pass the `--auth` parameter into `stackql` with Azure configur
2323
- Terraform: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
2424
- SDK: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#section-readme
2525
- Azure Service Principal setup: https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication-service-principal?tabs=azure-cli
26+
27+
## k8s auth
28+
29+
k8s supports an adaptable auth flow [client-go credential plugins](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins), which can be and is leveraged by k8s vendors.
30+
31+
- Google have chosen to funnel their k8s auth offering through a `gcloud` plugin, which is opaque. Here is [a community golang implementation](https://pkg.go.dev/github.com/traviswt/gke-auth-plugin).
32+
4

internal/stackql/astformat/ast_format_default.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ func DefaultSelectExprsFormatter(buf *sqlparser.TrackedBuffer, node sqlparser.SQ
99
case sqlparser.ColIdent:
1010
formatColIdent(node, buf)
1111
return
12+
case sqlparser.TableName:
13+
buf.WriteString(node.GetRawVal())
14+
return
1215
default:
1316
node.Format(buf)
1417
return

internal/stackql/parserutil/parser_util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,8 @@ func RenderDDLSelectStmt(ddl *sqlparser.DDL) string {
935935
}
936936

937937
func renderDDLSelectStmt(ddl *sqlparser.DDL) string {
938-
return strings.ReplaceAll(
939-
astformat.String(ddl.SelectStatement, astformat.DefaultSelectExprsFormatter), `"`, "")
938+
intermediateStr := astformat.String(ddl.SelectStatement, astformat.DefaultSelectExprsFormatter)
939+
return intermediateStr
940940
}
941941

942942
func RenderRefreshMaterializedViewSelectStmt(ref *sqlparser.RefreshMaterializedView) string {

test/assets/expected/aws/ce/ce-materialized-view.txt

Lines changed: 184 additions & 0 deletions
Large diffs are not rendered by default.

test/python/flask/aws/root_path_cfg.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
{
2+
"POST:/:ce_01": {
3+
"method": "POST",
4+
"path": "/",
5+
"headers": {
6+
"Authorization": [
7+
"^.*SignedHeaders=.*x-amz-target.*$"
8+
],
9+
"X-Amz-Target": [
10+
"AWSInsightsIndexService.GetCostAndUsage"
11+
]
12+
},
13+
"body_conditions": {
14+
"type": "JSON",
15+
"json": {
16+
"Granularity": "MONTHLY"
17+
},
18+
"matchType": "ONLY_MATCHING_FIELDS"
19+
},
20+
"template": "cost_explorer_services_01.json",
21+
"status": 200,
22+
"response_headers": {
23+
"Content-Type": ["application/x-amz-json-1.0"]
24+
}
25+
},
226
"POST:/:0": {
327
"method": "POST",
428
"path": "/",

0 commit comments

Comments
 (0)