From a156e3296ca9e91eed8bcd6447533b01150a4f06 Mon Sep 17 00:00:00 2001 From: zyd14 Date: Tue, 5 Nov 2024 05:47:45 -0700 Subject: [PATCH] [dagster-polars] Preventing import errors when users don't have gcp modules installed (#25708) ## Summary & Motivation Addressing #25705 ## How I Tested These Changes Created a new virtual environment in which I installed the dagster-polars package from the local source. Then created a script which imported dagster_polars, reproducing the ImportError. Then I added the exception for dagster-polars[gcp], which allowed the package to import successfully. ## Changelog > Preventing dagster-polars from raising ImportError when bigquery libraries are not installed --- .../dagster-polars/dagster_polars/io_managers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_modules/libraries/dagster-polars/dagster_polars/io_managers/__init__.py b/python_modules/libraries/dagster-polars/dagster_polars/io_managers/__init__.py index 7e9c959a4bd53..1df29edf4ccac 100644 --- a/python_modules/libraries/dagster-polars/dagster_polars/io_managers/__init__.py +++ b/python_modules/libraries/dagster-polars/dagster_polars/io_managers/__init__.py @@ -28,7 +28,7 @@ __all__.extend(["PolarsBigQueryIOManager", "PolarsBigQueryTypeHandler"]) except ImportError as e: - if "google-cloud-bigquery" in str(e): + if "google-cloud-bigquery" in str(e) or "dagster-polars[gcp]" in str(e): pass else: raise e