0

I am trying to access bigquery using python and running into the following error and was wondering if you can help me out to debug the issue

delete_job = client.query(sql_raw)
    try:
        delete_job.result()  # Waits for job to complete.
        print("Job was successful")
    except exceptions.BadRequest:
        handle_exceptions(delete_job)

Sql_raw = """delete from A.table_1 where activity_date in (select distinct  activity_date from A.table_B);

insert into  A.table_1 select * from A.table_2 ;"""


Error 

Traceback (most recent call last):
  File "/Python_Envs/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Python_Envs/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Python_Packages/ec2-python_old.zip/m/executor/__main__.py", line 192, in <module>
  File "/Python_Packages/ec2-python_old.zip/m/executor/__main__.py", line 183, in main
  File "/Python_Packages/ec2-python_old.zip/m/d/A/custom.py", line 223, in load
  File "/Python_Envs/3.6.1/lib/python3.6/site-packages/google/cloud/bigquery/job.py", line 1950, in result
    retry=retry)
  File "/Python_Envs/3.6.1/lib/python3.6/site-packages/google/cloud/bigquery/client.py", line 1274, in list_rows
    path='%s/data' % (table.path,),
AttributeError: 'NoneType' object has no attribute 'path'

Update : I think its a bug with python 3.6.1 packages or something. I update my python to 3.6.5 and its working fine now.

datainsights
  • 51
  • 1
  • 6
  • You may find the answers in this questions helpful for debugging this issue: https://stackoverflow.com/questions/38574821/exception-attributeerror-nonetype-object-has-no-attribute-path-in – Ben P Dec 18 '19 at 16:15
  • It seems related to this issue https://github.com/googleapis/google-cloud-python/pull/8206 – ebeltran Dec 18 '19 at 19:29

1 Answers1

0

You can try this way:

try:
    job.result()  # Waits for table load to complete.

except:
    print(job.exception())
Oksana Ok
  • 515
  • 3
  • 7
  • 19