

\--  
python/google-cloud-bigquery==0.27.0 利用し client.run_sync_query()
APIのquery_parameters
を利用してみたのだが、バインド変数(`@table_prefix`)が置換されない。スタックトレースを見る限り機能していないように見えるが、コードとして何か不備があるのか？

\--  
i tried to call run_sync_query api with query_parameters using python with
google-cloud-bigquery==0.27.0.  
I got error.  
it seems it's not working.  
According to stack-trace  
the bind variable(@table_prefix) was kept without replacing values.  
what should i fix my script?

myscript.py

[code]

    query="""
    #standardSQL
    select _table_suffix as suf from `dataset.@table_prefix*`
    where _table_suffix = '20171030'
    """
    query_parameters=[
    ScalarQueryParameter('table_prefix', 'STRING', mytable)
    ]
    result = self.client.run_sync_query(query=query, \
    query_parameters=query_parmeters)
    result.run()
    
[/code]

## stacktrace

[code]

      File "/usr/local/lib/python2.7/dist-packages/google/cloud/bigquery/query.py", line 387, in run
        method='POST', path=path, data=self._build_resource())
      File "/usr/local/lib/python2.7/dist-packages/google/cloud/_http.py", line 293, in api_request
        raise exceptions.from_http_response(response)
    BadRequest: 400 POST https://www.googleapis.com/bigquery/v2/projects//queries: Invalid table name: dataset.@table_prefix*
    
[/code]

\--  
"dataset" has table "mytable20171030".


CC BY-SA 3.0
2017-10-30T06:08:41.320
39149
2017-10-31T05:54:34.750
2017-10-31T05:54:34.750
25975
25975
question
python google-bigquery
bigquery api の run_sync_query() メソッドのパラメータ "query_parameter" が機能しない?