Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"show methods in azure.dev_center.customization_tasks;",
"set global \"a.b\"=1;",
"set global \"$.auth.google.sub\"='krimmer@stackql.io';",
"select JSON_EXTRACT(saml.samlIdentity, '$.username') as saml_username from github.scim.saml_ids saml where saml.org = 'dummyorg';"
],
"default": "show providers;"
},
Expand Down Expand Up @@ -315,6 +316,16 @@
"options": [
"{\"keyFilePath\": \"${workspaceFolder}/test/server/mtls/credentials/pg_server_key.pem\", \"certFilePath\": \"${workspaceFolder}/test/server/mtls/credentials/pg_server_cert.pem\", \"clientCAs\": [\"\"]}"
]
},
{
"type": "pickString",
"id": "httpLogEnabled",
"description": "http log enabled",
"default": "false",
"options": [
"true",
"false"
]
}
],
"configurations": [
Expand Down Expand Up @@ -380,6 +391,7 @@
"--export.alias=${input:exportAliasString}",
"--dataflow.dependency.max=${input:dataflowDependencyMax}",
"--dataflow.components.max=${input:dataflowComponentsMax}",
"--http.log.enabled=${input:httpLogEnabled}",
"${input:queryString}"
],
},
Expand Down
57 changes: 57 additions & 0 deletions internal/stackql/dto/runtime_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,60 @@ func (rc *RuntimeCtx) Set(key string, val string) error {
}
return retVal
}

func (rc RuntimeCtx) Copy() RuntimeCtx {
return RuntimeCtx{
APIRequestTimeout: rc.APIRequestTimeout,
AuthRaw: rc.AuthRaw,
CABundle: rc.CABundle,
AllowInsecure: rc.AllowInsecure,
CacheKeyCount: rc.CacheKeyCount,
CacheTTL: rc.CacheTTL,
ConfigFilePath: rc.ConfigFilePath,
CPUProfile: rc.CPUProfile,
CSVHeadersDisable: rc.CSVHeadersDisable,
Delimiter: rc.Delimiter,
DryRunFlag: rc.DryRunFlag,
ErrorPresentation: rc.ErrorPresentation,
ExecutionConcurrencyLimit: rc.ExecutionConcurrencyLimit,
HTTPLogEnabled: rc.HTTPLogEnabled,
HTTPMaxResults: rc.HTTPMaxResults,
HTTPPageLimit: rc.HTTPPageLimit,
HTTPProxyHost: rc.HTTPProxyHost,
HTTPProxyPassword: rc.HTTPProxyPassword,
HTTPProxyPort: rc.HTTPProxyPort,
HTTPProxyScheme: rc.HTTPProxyScheme,
HTTPProxyUser: rc.HTTPProxyUser,
IndirectDepthMax: rc.IndirectDepthMax,
DataflowComponentsMax: rc.DataflowComponentsMax,
DataflowDependencyMax: rc.DataflowDependencyMax,
InfilePath: rc.InfilePath,
LogLevelStr: rc.LogLevelStr,
OutfilePath: rc.OutfilePath,
OutputFormat: rc.OutputFormat,
ApplicationFilesRootPath: rc.ApplicationFilesRootPath,
ApplicationFilesRootPathMode: rc.ApplicationFilesRootPathMode,
PGSrvAddress: rc.PGSrvAddress,
PGSrvLogLevel: rc.PGSrvLogLevel,
PGSrvPort: rc.PGSrvPort,
PGSrvRawTLSCfg: rc.PGSrvRawTLSCfg,
ExportAlias: rc.ExportAlias,
ProviderStr: rc.ProviderStr,
RegistryRaw: rc.RegistryRaw,
SessionCtxRaw: rc.SessionCtxRaw,
SQLBackendCfgRaw: rc.SQLBackendCfgRaw,
DBInternalCfgRaw: rc.DBInternalCfgRaw,
NamespaceCfgRaw: rc.NamespaceCfgRaw,
StoreTxnCfgRaw: rc.StoreTxnCfgRaw,
GCCfgRaw: rc.GCCfgRaw,
ACIDCfgRaw: rc.ACIDCfgRaw,
QueryCacheSize: rc.QueryCacheSize,
TemplateCtxFilePath: rc.TemplateCtxFilePath,
TestWithoutAPICalls: rc.TestWithoutAPICalls,
UseNonPreferredAPIs: rc.UseNonPreferredAPIs,
VarList: rc.VarList,
VerboseFlag: rc.VerboseFlag,
ViperCfgFileName: rc.ViperCfgFileName,
WorkOffline: rc.WorkOffline,
}
}
4 changes: 2 additions & 2 deletions internal/stackql/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (hc *standardHandlerContext) LogHTTPResponseMap(target interface{}) {
//nolint:nestif // ignore nested if
if hc.runtimeContext.HTTPLogEnabled {
switch target := target.(type) {
case map[string]interface{}, []interface{}:
case []map[string]interface{}, map[string]interface{}, []interface{}:
b, err := json.MarshalIndent(target, "", " ")
if err != nil {
//nolint:errcheck // ignore error on output stream
Expand Down Expand Up @@ -525,7 +525,7 @@ func GetHandlerCtx(
sessionCtxMutex: &sync.Mutex{},
providersMapMutex: &sync.Mutex{},
rawQuery: cmdString,
runtimeContext: runtimeCtx,
runtimeContext: runtimeCtx.Copy(),
providers: providers,
authContexts: inputBundle.GetAuthContexts(),
registry: reg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (ss *GraphQLSingleSelectAcquire) Build() error {
}
for {
response, err := graphQLReader.Read()
ss.handlerCtx.LogHTTPResponseMap(response)
if len(response) > 0 {
if !housekeepingDone && ss.insertPreparedStatementCtx != nil {
_, err = ss.handlerCtx.GetSQLEngine().Exec(ss.insertPreparedStatementCtx.GetGCHousekeepingQueries())
Expand Down
Loading