sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery

自作多情 提交于 2020-12-13 17:58:32

问题


Trying to create a bigquery connector using sqlalchemy

from sqlalchemy import create_engine
engine = create_engine('bigquery://<project_id>/<project_name>',
                   credentials_path=GCP_KEY)
conn = engine.connect()

Error:

sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery

回答1:


Your error is generally related to the lack of some required module to use SQLAlchemy.

Therefore, after going though the documentation, I found out that you should install the requirements in you environment using:

pip3 install pybigquery

In addition, within your script you should import the following modules:

  1. SQLAchemy

    from sqlalchemy import * from sqlalchemy.engine import create_engine from sqlalchemy.schema import *

  2. API Client

    from pybigquery.api import ApiClient

Afterwards, you should have all the necessary packages to execute your code.

If you have any more question about using the SQLAlchemy and API client for BigQuery, you can consult the provided documentation above or I would also be glad to help.



来源:https://stackoverflow.com/questions/60294040/sqlalchemy-exc-nosuchmoduleerror-cant-load-plugin-sqlalchemy-dialectsbigquer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!