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: error when bigquery dependencies not installed #133

Merged
merged 5 commits into from
Mar 22, 2024

Conversation

jgoizueta
Copy link
Contributor

Issue

If raster-loader is installed without the optional bigquery dependencies if fails with uncontrolled error even if bigquery not used:

Traceback (most recent call last):
  File "/Users/ernesto/cartodb/rasterenv/bin/carto", line 5, in <module>
    from raster_loader.cli import main
  File "/Users/ernesto/cartodb/raster-loader/raster_loader/__init__.py", line 3, in <module>
    from raster_loader.io.bigquery import (
  File "/Users/ernesto/cartodb/raster-loader/raster_loader/io/bigquery.py", line 33, in <module>
    class AccessTokenCredentials(Credentials):
                                 ^^^^^^^^^^^
NameError: name 'Credentials' is not defined    

Proposed Changes

Prevent the uncontrolled error; if bigquery is used and the depencies are not available fail with the same error message as before the bug was introduced:

Google Cloud BigQuery is not installed.
Please install Google Cloud BigQuery to use this function.
See https://googleapis.dev/python/bigquery/latest/index.html
for installation instructions.
OR, run `pip install google-cloud-bigquery` to install from pypi.

@jgoizueta jgoizueta added the bug Something isn't working label Mar 22, 2024
@jgoizueta jgoizueta requested review from volaya and thedae March 22, 2024 08:17
@Jesus89
Copy link
Member

Jesus89 commented Mar 22, 2024

import_error_bigquery

Google Cloud BigQuery client is not installed.
Please install Google Cloud BigQuery dependencies to use this function.
run `pip install -U raster-loader[bigquery]` to install from pypi.

import_error_snowflake

Snowflake client is not installed.
Please install Snowflake dependencies to use this function.
run `pip install -U raster-loader[snowflake]` to install from pypi.

Remove:

  • import_error_rasterio
  • import_error_rio_cogeo
  • import_error_quadbin

@Jesus89
Copy link
Member

Jesus89 commented Mar 22, 2024

Please update the error messages according to the previous comment

@jgoizueta jgoizueta merged commit dd462aa into main Mar 22, 2024
4 checks passed
@jgoizueta jgoizueta deleted the hotfix-no-bigquery branch March 22, 2024 12:06
@Jesus89 Jesus89 mentioned this pull request Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants