Reputation: 881
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
Upvotes: 5
Views: 14578
Reputation: 4051
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
from sqlalchemy import *
from sqlalchemy.engine import create_engine
from sqlalchemy.schema import *
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.
Upvotes: 9