Reduce boilerplate for custom tabular bq notebook (#1207)

* Reduced boilerplate

Ran linter and fixed install

Added pyarrow

Fixed pip install

Reverted unneeded changes

Fixed pip install

Linted code and added missing preprocessor call

Fixed preprocessor

Default to us-central1

* Ran linter

* Simplified service account section
This commit is contained in:
Ivan Cheung
2022-11-10 17:47:13 -05:00
committed by GitHub
parent 0ca86220f8
commit 6ccad69a18
5 changed files with 132 additions and 441 deletions
+4 -9
View File
@@ -61,9 +61,7 @@ def archive_code_and_upload(staging_bucket: str):
def download_blob_into_memory(
bucket_name: str,
blob_name: str,
download_as_text: Optional[bool]=False
bucket_name: str, blob_name: str, download_as_text: Optional[bool] = False
) -> Union[bytes, str]:
"""
Downloads a blob into memory as byte or as text if
@@ -79,13 +77,10 @@ def download_blob_into_memory(
# Download the blob content
if download_as_text:
contents = blob.download_as_text()
contents = blob.download_as_text()
else:
contents = blob.download_as_bytes()
contents = blob.download_as_bytes()
print(
f"Downloaded storage object {blob_name} from bucket {bucket_name}."
)
print(f"Downloaded storage object {blob_name} from bucket {bucket_name}.")
return contents