I want to load data from csv to BigQuery and it shows this error.
My code:
df.to_gbq(destination_table = '[dataset].[table]',project_id='projectname', if_exists = 'append')
Error:
~/opt/anaconda3/lib/python3.8/site-packages/google/cloud/bigquery/__init__.py in <module>
33 __version__ = get_distribution("google-cloud-bigquery").version
34
---> 35 from google.cloud.bigquery.client import Client
36 from google.cloud.bigquery.dataset import AccessEntry
37 from google.cloud.bigquery.dataset import Dataset
~/opt/anaconda3/lib/python3.8/site-packages/google/cloud/bigquery/client.py in <module>
56 from google.cloud.bigquery._helpers import _verify_job_config_type
57 from google.cloud.bigquery._http import Connection
---> 58 from google.cloud.bigquery import _pandas_helpers
59 from google.cloud.bigquery.dataset import Dataset
60 from google.cloud.bigquery.dataset import DatasetListItem
~/opt/anaconda3/lib/python3.8/site-packages/google/cloud/bigquery/_pandas_helpers.py in <module>
38 pyarrow = None
39
---> 40 from google.cloud.bigquery import schema
41
42
~/opt/anaconda3/lib/python3.8/site-packages/google/cloud/bigquery/schema.py in <module>
26 # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
27 LEGACY_TO_STANDARD_TYPES = {
---> 28 "STRING": types.StandardSqlDataType.STRING,
29 "BYTES": types.StandardSqlDataType.BYTES,
30 "INTEGER": types.StandardSqlDataType.INT64,
AttributeError: type object 'StandardSqlDataType' has no attribute 'STRING'
How can i fix this? I try a few recommendation like this. But still cannot works.
pip install `google-cloud-bigquery`
Is there any other way?
Thank you