Skip to content

Commit

Permalink
add unknown type instead of making optional
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal committed Jul 1, 2022
1 parent 32377f1 commit 3c0f1bb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class QueryEvent:
timestamp: datetime
actor_email: str
query: str
statementType: Optional[str] = None
statementType: str

job_name: Optional[str] = None
destinationTable: Optional[BigQueryTableRef] = None
Expand Down Expand Up @@ -503,7 +503,7 @@ def from_entry(cls, entry: AuditLogEntry) -> "QueryEvent":
if "queryOutputRowCount" in job["jobStatistics"]
and job["jobStatistics"]["queryOutputRowCount"]
else None,
statementType=job_query_conf.get("statementType"),
statementType=job_query_conf.get("statementType", "UNKNOWN"),
)
# destinationTable
raw_dest_table = job_query_conf.get("destinationTable")
Expand Down Expand Up @@ -580,7 +580,7 @@ def from_exported_bigquery_audit_metadata(
numAffectedRows=int(query_stats["outputRowCount"])
if query_stats.get("outputRowCount")
else None,
statementType=query_config.get("statementType"),
statementType=query_config.get("statementType", "UNKNOWN"),
)
# jobName
query_event.job_name = job.get("jobName")
Expand Down Expand Up @@ -642,7 +642,7 @@ def from_entry_v2(cls, row: BigQueryAuditMetadata) -> "QueryEvent":
numAffectedRows=int(query_stats["outputRowCount"])
if "outputRowCount" in query_stats and query_stats["outputRowCount"]
else None,
statementType=query_config.get("statementType"),
statementType=query_config.get("statementType", "UNKNOWN"),
)
query_event.job_name = job.get("jobName")
# destinationTable
Expand Down

0 comments on commit 3c0f1bb

Please sign in to comment.