Skip to content

Commit 6d4e6d0

Browse files
- All tests passing locally.
1 parent fa3a0dd commit 6d4e6d0

File tree

10 files changed

+30
-11
lines changed

10 files changed

+30
-11
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
"select * from aws.iam.user_policies where region = 'us-east-1' and UserName = 'joe.blow' order by member asc;",
182182
"replace /*+ AWAIT */ google.compute.firewalls set data__disabled = 'true' where project = 'mutable-project' and firewall = 'replacable-firewall' returning *;",
183183
"delete from aws.transfer.servers where data__ServerId = 's-0000000001' and region = 'ap-southeast-2';",
184+
"replace google.compute.firewalls set data__disabled = 'true' where project = 'mutable-project' and firewall = 'replacable-firewall' returning *;",
184185
],
185186
"default": "show providers;"
186187
},

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/spf13/cobra v1.4.0
1717
github.com/spf13/pflag v1.0.5
1818
github.com/spf13/viper v1.10.1
19-
github.com/stackql/any-sdk v0.2.2-alpha26
19+
github.com/stackql/any-sdk v0.2.2-alpha27
2020
github.com/stackql/go-suffix-map v0.0.1-alpha01
2121
github.com/stackql/psql-wire v0.1.1-beta23
2222
github.com/stackql/stackql-parser v0.0.15-alpha06

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
461461
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
462462
github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk=
463463
github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU=
464-
github.com/stackql/any-sdk v0.2.2-alpha26 h1:ydjW77NUX2yF4d6DbNa3OP53gOzHB1LUA0Qeb+r5LZk=
465-
github.com/stackql/any-sdk v0.2.2-alpha26/go.mod h1:m1o5TCfyKkdt2bREB3itwPv1MhM+lk4eu24KpPohFoY=
464+
github.com/stackql/any-sdk v0.2.2-alpha27 h1:wAScNhUh1OhyXfYTSAcE89txVd9dK5BaE0pEd3LDtWI=
465+
github.com/stackql/any-sdk v0.2.2-alpha27/go.mod h1:m1o5TCfyKkdt2bREB3itwPv1MhM+lk4eu24KpPohFoY=
466466
github.com/stackql/go-suffix-map v0.0.1-alpha01 h1:TDUDS8bySu41Oo9p0eniUeCm43mnRM6zFEd6j6VUaz8=
467467
github.com/stackql/go-suffix-map v0.0.1-alpha01/go.mod h1:QAi+SKukOyf4dBtWy8UMy+hsXXV+yyEE4vmBkji2V7g=
468468
github.com/stackql/psql-wire v0.1.1-beta23 h1:1ayYMjZArfDcIMyEOKnm+Bp1zRCISw8pguvTFuUhhVQ=

internal/stackql/dependencyplanner/dependencyplanner.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ func (dp *standardDependencyPlanner) processOrphan(
408408
} else {
409409
// Persist SQL mirror table here prior to generating insert DML
410410
drmCfg := dp.handlerCtx.GetDrmConfig()
411-
ddl, ddlErr := drmCfg.GenerateDDL(anTab, nil, nil, nil, opStore, 0, false, false)
411+
// TODO: extract isAwait somehow
412+
ddl, ddlErr := drmCfg.GenerateDDL(anTab, nil, nil, nil, opStore, false, 0, false, false)
412413
if ddlErr != nil {
413414
return nil, nil, ddlErr
414415
}
@@ -570,6 +571,7 @@ func (dp *standardDependencyPlanner) processAcquire(
570571
svc,
571572
resource,
572573
m,
574+
false, // TODO: wire up isAwait
573575
[]util.AnnotatedTabulation{anTab},
574576
dp.primitiveComposer.GetSQLEngine(),
575577
prov.GetName(),

internal/stackql/docparser/doc_parser.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func OpenapiStackQLTabulationsPersistor(
3838
svc anysdk.Service,
3939
resource anysdk.Resource,
4040
m anysdk.StandardOperationStore,
41+
isAwait bool,
4142
tabluationsAnnotated []util.AnnotatedTabulation,
4243
dbEngine sqlengine.SQLEngine,
4344
prefix string,
@@ -68,7 +69,7 @@ func OpenapiStackQLTabulationsPersistor(
6869
return discoveryGenerationID, err
6970
}
7071
for _, tblt := range tabluationsAnnotated {
71-
ddl, ddlErr := drmCfg.GenerateDDL(tblt, prov, svc, resource, m, discoveryGenerationID, false, true)
72+
ddl, ddlErr := drmCfg.GenerateDDL(tblt, prov, svc, resource, m, isAwait, discoveryGenerationID, false, true)
7273
if ddlErr != nil {
7374
displayErr := fmt.Errorf("error generating DDL: %w", err)
7475
logging.GetLogger().Infoln(displayErr.Error())

internal/stackql/drm/drm_cfg.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type Config interface {
4848
GetCurrentTable(internaldto.HeirarchyIdentifiers) (internaldto.DBTable, error)
4949
GetRelationalType(string) string
5050
GenerateDDL(util.AnnotatedTabulation, anysdk.Provider,
51-
anysdk.Service, anysdk.Resource, anysdk.StandardOperationStore,
51+
anysdk.Service, anysdk.Resource, anysdk.StandardOperationStore, bool,
5252
int, bool, bool) ([]string, error)
5353
GetControlAttributes() sqlcontrol.ControlAttributes
5454
GetGolangValue(string) interface{}
@@ -457,6 +457,7 @@ func (dc *staticDRMConfig) genRelationalTable(
457457
svc anysdk.Service,
458458
resource anysdk.Resource,
459459
m anysdk.StandardOperationStore,
460+
isAwait bool,
460461
discoveryGenerationID int,
461462
isNilResponseAlloed bool,
462463
) (relationaldto.RelationalTable, error) {
@@ -483,6 +484,7 @@ func (dc *staticDRMConfig) genRelationalTable(
483484
resource,
484485
m,
485486
m.GetProjections(),
487+
isAwait,
486488
)
487489
addressSpaceErr := addressSpaceFormulator.Formulate()
488490
if addressSpaceErr != nil {
@@ -521,12 +523,13 @@ func (dc *staticDRMConfig) GenerateDDL(
521523
svc anysdk.Service,
522524
resource anysdk.Resource,
523525
m anysdk.StandardOperationStore,
526+
isAwait bool,
524527
discoveryGenerationID int,
525528
dropTable bool,
526529
isNilResponseAlloed bool,
527530
) ([]string, error) {
528531
relationalTable, err := dc.genRelationalTable(
529-
tabAnn, prov, svc, resource, m, discoveryGenerationID, isNilResponseAlloed)
532+
tabAnn, prov, svc, resource, m, isAwait, discoveryGenerationID, isNilResponseAlloed)
530533
if err != nil {
531534
return nil, err
532535
}

internal/stackql/primitivegenerator/unary_selection.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func (pb *standardPrimitiveGenerator) assembleUnarySelectionBuilder(
5858
svc,
5959
resource,
6060
method,
61+
methodAnalysisOutput.IsAwait(),
6162
[]util.AnnotatedTabulation{annotatedInsertTabulation},
6263
pb.PrimitiveComposer.GetSQLEngine(),
6364
prov.GetName(),

internal/stackql/router/obtain_context/obtain_context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func ObtainAnnotationCtx(
2222
isPGInternalObject := tbl.GetHeirarchyObjects().IsPGInternalObject()
2323
if isView || isSQLDataSource || isSubquery || isPGInternalObject {
2424
// TODO: upgrade this flow; nil == YUCK!!!
25-
return taxonomy.NewStaticStandardAnnotationCtx(nil, tbl.GetHeirarchyObjects().GetHeirarchyIDs(), tbl, parameters), nil
25+
return taxonomy.NewStaticStandardAnnotationCtx(nil, tbl.GetHeirarchyObjects().GetHeirarchyIDs(), tbl, parameters, false), nil
2626
}
2727
schema, mediaType, err := tbl.GetResponseSchemaAndMediaType()
2828
if err != nil {
@@ -57,5 +57,5 @@ func ObtainAnnotationCtx(
5757
if isView {
5858
hIDs = hIDs.WithView(viewDTO)
5959
}
60-
return taxonomy.NewStaticStandardAnnotationCtx(itemObjS, hIDs, tbl, parameters), nil
60+
return taxonomy.NewStaticStandardAnnotationCtx(itemObjS, hIDs, tbl, parameters, false), nil
6161
}

internal/stackql/router/parameter_router.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ func (sp *standardParamSplitter) assembleSplitParams(
256256
rawAnnotationCtx.GetHIDs(),
257257
rawAnnotationCtx.GetTableMeta().Clone(),
258258
com,
259+
rawAnnotationCtx.IsAwait(),
259260
)
260261
sp.splitAnnotationContextMap.Put(rawAnnotationCtx, splitAnnotationCtx)
261262
// TODO: this has gotta replace the original and also be duplicated

internal/stackql/taxonomy/annotation_context.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type AnnotationCtx interface {
2424
GetTableMeta() tablemetadata.ExtendedTableMetadata
2525
Prepare(handlerCtx handler.HandlerContext, inStream streaming.MapStream) error
2626
SetDynamic()
27+
IsAwait() bool
2728
Equals(AnnotationCtx) bool
2829
Clone() AnnotationCtx
2930
}
@@ -34,23 +35,30 @@ type standardAnnotationCtx struct {
3435
hIDs internaldto.HeirarchyIdentifiers
3536
tableMeta tablemetadata.ExtendedTableMetadata
3637
parameters map[string]interface{}
38+
isAwait bool
3739
}
3840

3941
func NewStaticStandardAnnotationCtx(
4042
schema anysdk.Schema,
4143
hIDs internaldto.HeirarchyIdentifiers,
4244
tableMeta tablemetadata.ExtendedTableMetadata,
4345
parameters map[string]interface{},
46+
isAwait bool,
4447
) AnnotationCtx {
4548
return &standardAnnotationCtx{
4649
isDynamic: false,
4750
schema: schema,
4851
hIDs: hIDs,
4952
tableMeta: tableMeta,
5053
parameters: parameters,
54+
isAwait: isAwait,
5155
}
5256
}
5357

58+
func (ac *standardAnnotationCtx) IsAwait() bool {
59+
return ac.isAwait
60+
}
61+
5462
func (ac *standardAnnotationCtx) Equals(other AnnotationCtx) bool {
5563
otherStandard, isStandard := other.(*standardAnnotationCtx)
5664
if !isStandard {
@@ -59,6 +67,9 @@ func (ac *standardAnnotationCtx) Equals(other AnnotationCtx) bool {
5967
if ac.isDynamic != otherStandard.isDynamic {
6068
return false
6169
}
70+
if ac.isAwait != otherStandard.isAwait {
71+
return false
72+
}
6273
if ac.schema != otherStandard.schema {
6374
return false
6475
}
@@ -101,6 +112,7 @@ func (ac *standardAnnotationCtx) Clone() AnnotationCtx {
101112
hIDs: ac.hIDs,
102113
tableMeta: ac.tableMeta.Clone(),
103114
parameters: clonedParams,
115+
isAwait: ac.isAwait,
104116
}
105117
}
106118

@@ -129,8 +141,6 @@ func (ac *standardAnnotationCtx) Prepare(
129141
if isSQLDataSource {
130142
ac.tableMeta.SetSQLDataSource(sqlDataSource)
131143
// TODO: persist mirror table here a la GenerateInsertDML()
132-
// anTab := util.NewAnnotatedTabulation(tab, ac.GetHIDs(), inputTableName, annotationCtx.GetTableMeta().GetAlias())
133-
// ddl, err := handlerCtx.GetDrmConfig().GenerateDDL(ac.tableMeta, nil, 0, false)
134144
return nil
135145
}
136146
pr, err := ac.GetTableMeta().GetProvider()

0 commit comments

Comments
 (0)