1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Airflow on Kubernetes】トラブルシューティング - AttributeError: '_jpype.PyJPField' object has no attribute 'getStaticAttribute'

Last updated at Posted at 2019-08-21

概要

JPype1==0.7.0を利用してJdbcOperator()を実行すると表題のエラーが出力される。

目次

バージョン

DAG

一部抜粋

from airflow.operators.jdbc_operator import JdbcOperator

sql_task = JdbcOperator(
    task_id='sql_cmd',
    jdbc_conn_id='my_connection_id',
    #template_searchpath='/etc/dev/airflow/templates',
    #sql=['sample.sql'],
    sql=['select id,name from sample_table'],
    params={"db":'MY_DBNAME'},
    dag=dag
)

エラー詳細

ログの見方:DAGの実行結果ログを確認する

[2019-08-21 09:30:48,913] {taskinstance.py:1047} ERROR - '_jpype.PyJPField' object has no attribute 'getStaticAttribute'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/airflow/models/taskinstance.py", line 922, in _run_raw_task
    result = task_copy.execute(context=context)
  File "/usr/local/lib/python2.7/dist-packages/airflow/operators/jdbc_operator.py", line 63, in execute
    self.hook.run(self.sql, self.autocommit, parameters=self.parameters)
  File "/usr/local/lib/python2.7/dist-packages/airflow/hooks/dbapi_hook.py", line 159, in run
    with closing(self.get_conn()) as conn:
  File "/usr/local/lib/python2.7/dist-packages/airflow/hooks/jdbc_hook.py", line 51, in get_conn
    jars=jdbc_driver_loc.split(","))
  File "/usr/local/lib/python2.7/dist-packages/jaydebeapi/__init__.py", line 381, in connect
    jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
  File "/usr/local/lib/python2.7/dist-packages/jaydebeapi/__init__.py", line 183, in _jdbc_connect_jpype
    types_map[i.getName()] = i.getStaticAttribute()
AttributeError: '_jpype.PyJPField' object has no attribute 'getStaticAttribute'

対策

JPype1==0.6.3ではエラーにならないのでダウングレードをする。

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?