sqlalchemy.exc.NoSuchModuleError:无法加载插件:sqlalchemy.dialects:bigquery [英] sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery
问题描述
尝试使用sqlalchemy创建bigquery连接器
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()
错误:
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery
推荐答案
您的错误通常与缺少使用SQLAlchemy所需的某些模块有关.
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:
-
SQLAchemy
SQLAchemy
*从sqlalchemy.engine导入create_engine从sqlalchemy.schema导入*
API客户端
导入ApiClient
然后,您应该具有执行代码所需的所有必需软件包.
Afterwards, you should have all the necessary packages to execute your code.
如果您对将SQLAlchemy和API客户端用于BigQuery还有其他疑问,可以查阅上面提供的文档,否则我也很乐意为您提供帮助.
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.
这篇关于sqlalchemy.exc.NoSuchModuleError:无法加载插件:sqlalchemy.dialects:bigquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!