-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/pip/ddtrace-approx-eq-1.19
- Loading branch information
Showing
17 changed files
with
407 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Serverless Spark to Poll with .GetBatch() instead of using operation.result() | ||
time: 2023-07-21T10:10:41.64843-07:00 | ||
custom: | ||
Author: wazi55 | ||
Issue: "734" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Address type annotation issues and remove protected method ref from impl | ||
time: 2023-09-21T15:56:45.329798-07:00 | ||
custom: | ||
Author: colin-rogers-dbt | ||
Issue: "933" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: update SQLQuery to include node_info | ||
time: 2023-09-22T11:42:17.770033-07:00 | ||
custom: | ||
Author: colin-rogers-dbt | ||
Issue: "936" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Fixed a mypy failure by reworking BigQueryAdapter constructor. | ||
time: 2023-09-22T12:53:27.339599-04:00 | ||
custom: | ||
Author: peterallenwebb | ||
Issue: "934" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Add tests for inlined limit + sql-header in dbt show query | ||
time: 2023-09-25T14:36:28.335466+01:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "940" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# **what?** | ||
# Cleanup branches left over from automation and testing. Also cleanup | ||
# draft releases from release testing. | ||
|
||
# **why?** | ||
# The automations are leaving behind branches and releases that clutter | ||
# the repository. Sometimes we need them to debug processes so we don't | ||
# want them immediately deleted. Running on Saturday to avoid running | ||
# at the same time as an actual release to prevent breaking a release | ||
# mid-release. | ||
|
||
# **when?** | ||
# Mainly on a schedule of 12:00 Saturday. | ||
# Manual trigger can also run on demand | ||
|
||
name: Repository Cleanup | ||
|
||
on: | ||
schedule: | ||
- cron: '0 12 * * SAT' # At 12:00 on Saturday - details in `why` above | ||
|
||
workflow_dispatch: # for manual triggering | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
cleanup-repo: | ||
uses: dbt-labs/actions/.github/workflows/repository-cleanup.yml@main | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from typing import Union, Dict | ||
|
||
import time | ||
from datetime import datetime | ||
from google.cloud.dataproc_v1 import ( | ||
CreateBatchRequest, | ||
BatchControllerClient, | ||
Batch, | ||
GetBatchRequest, | ||
) | ||
from google.protobuf.json_format import ParseDict | ||
|
||
from dbt.adapters.bigquery.connections import DataprocBatchConfig | ||
|
||
_BATCH_RUNNING_STATES = [Batch.State.PENDING, Batch.State.RUNNING] | ||
DEFAULT_JAR_FILE_URI = "gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.21.1.jar" | ||
|
||
|
||
def create_batch_request( | ||
batch: Batch, batch_id: str, project: str, region: str | ||
) -> CreateBatchRequest: | ||
return CreateBatchRequest( | ||
parent=f"projects/{project}/locations/{region}", # type: ignore | ||
batch_id=batch_id, # type: ignore | ||
batch=batch, # type: ignore | ||
) | ||
|
||
|
||
def poll_batch_job( | ||
parent: str, batch_id: str, job_client: BatchControllerClient, timeout: int | ||
) -> Batch: | ||
batch_name = "".join([parent, "/batches/", batch_id]) | ||
state = Batch.State.PENDING | ||
response = None | ||
run_time = 0 | ||
while state in _BATCH_RUNNING_STATES and run_time < timeout: | ||
time.sleep(1) | ||
response = job_client.get_batch( # type: ignore | ||
request=GetBatchRequest(name=batch_name), # type: ignore | ||
) | ||
run_time = datetime.now().timestamp() - response.create_time.timestamp() # type: ignore | ||
state = response.state | ||
if not response: | ||
raise ValueError("No response from Dataproc") | ||
if state != Batch.State.SUCCEEDED: | ||
if run_time >= timeout: | ||
raise ValueError( | ||
f"Operation did not complete within the designated timeout of {timeout} seconds." | ||
) | ||
else: | ||
raise ValueError(response.state_message) | ||
return response | ||
|
||
|
||
def update_batch_from_config(config_dict: Union[Dict, DataprocBatchConfig], target: Batch): | ||
try: | ||
# updates in place | ||
ParseDict(config_dict, target._pb) | ||
except Exception as e: | ||
docurl = ( | ||
"https://cloud.google.com/dataproc-serverless/docs/reference/rpc/google.cloud.dataproc.v1" | ||
"#google.cloud.dataproc.v1.Batch" | ||
) | ||
raise ValueError( | ||
f"Unable to parse dataproc_batch as valid batch specification. See {docurl}. {str(e)}" | ||
) from e | ||
return target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from dbt.tests.adapter.dbt_show.test_dbt_show import BaseShowSqlHeader, BaseShowLimit | ||
|
||
|
||
class TestBigQueryShowLimit(BaseShowLimit): | ||
pass | ||
|
||
|
||
class TestBigQueryShowSqlHeader(BaseShowSqlHeader): | ||
pass |
Oops, something went wrong.