Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest/bigquery): Correctly apply table pattern to read events; fix end time calculation; deprecate match_fully_qualified_names #9077

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ class BigQueryV2Config(
)

match_fully_qualified_names: bool = Field(
default=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this break all existing bigquery ingestion where it was not set earlier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've had a deprecation warning since I started... gotta follow up at some point. I'll add a doc change in a follow up though

description="Whether `dataset_pattern` is matched against fully qualified dataset name `<project_id>.<dataset_name>`.",
default=True,
description="[deprecated] Whether `dataset_pattern` is matched against fully qualified dataset name `<project_id>.<dataset_name>`.",
)

include_external_url: bool = Field(
Expand Down Expand Up @@ -327,8 +327,7 @@ def backward_compatibility_configs_set(cls, values: Dict) -> Dict:
):
logger.warning(
"Please update `dataset_pattern` to match against fully qualified schema name `<project_id>.<dataset_name>` and set config `match_fully_qualified_names : True`."
"Current default `match_fully_qualified_names: False` is only to maintain backward compatibility. "
"The config option `match_fully_qualified_names` will be deprecated in future and the default behavior will assume `match_fully_qualified_names: True`."
"The config option `match_fully_qualified_names` is deprecated and will be removed in a future release."
)
return values

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def _get_parsed_audit_log_events(self, project_id: str) -> Iterable[QueryEvent]:
# handle the case where the read happens within our time range but the query
# completion event is delayed and happens after the configured end time.
corrected_start_time = self.start_time - self.config.max_query_duration
corrected_end_time = self.end_time + -self.config.max_query_duration
corrected_end_time = self.end_time + self.config.max_query_duration
self.report.log_entry_start_time = corrected_start_time
self.report.log_entry_end_time = corrected_end_time

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,12 @@ def get_time_window(self) -> Tuple[datetime, datetime]:
def _is_table_allowed(self, table_ref: Optional[BigQueryTableRef]) -> bool:
return (
table_ref is not None
and self.config.dataset_pattern.allowed(table_ref.table_identifier.dataset)
and self.config.table_pattern.allowed(table_ref.table_identifier.table)
and self.config.dataset_pattern.allowed(
f"{table_ref.table_identifier.project_id}.{table_ref.table_identifier.dataset}"
if self.config.match_fully_qualified_names
else table_ref.table_identifier.dataset
)
and self.config.table_pattern.allowed(str(table_ref.table_identifier))
)

def _should_ingest_usage(self) -> bool:
Expand Down Expand Up @@ -844,7 +848,7 @@ def _get_parsed_bigquery_log_events(
# handle the case where the read happens within our time range but the query
# completion event is delayed and happens after the configured end time.
corrected_start_time = self.start_time - self.config.max_query_duration
corrected_end_time = self.end_time + -self.config.max_query_duration
corrected_end_time = self.end_time + self.config.max_query_duration
self.report.audit_start_time = corrected_start_time
self.report.audit_end_time = corrected_end_time

Expand Down
Loading