[
https://issues.apache.org/jira/browse/AIRFLOW-3767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16796092#comment-16796092
]
ASF subversion and git services commented on AIRFLOW-3767:
----------------------------------------------------------
Commit c433be2b05a37d4150685d5095670caa57531bd5 in airflow's branch
refs/heads/v1-10-stable from zhongjiajie
[ https://gitbox.apache.org/repos/asf?p=airflow.git;h=c433be2 ]
[AIRFLOW-3767] Correct bulk insert function (#4773)
* [AIRFLOW-3767] Correct bulk insert function
Fix Oracle hook bulk_insert bug when
param target_fields is None or rows
is empty iterable
* change without overwriting variables as Fokko said
> oracle hook bulk insert error while target_fields is DEFAULT values
> -------------------------------------------------------------------
>
> Key: AIRFLOW-3767
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3767
> Project: Apache Airflow
> Issue Type: Bug
> Components: hooks
> Affects Versions: 1.10.2
> Reporter: zhongjiajie
> Assignee: zhongjiajie
> Priority: Major
> Labels: easyfix
> Fix For: 1.10.3
>
>
> {code:java}
> def bulk_insert_rows(self, table, rows, target_fields=None,
> commit_every=5000):
> conn = self.get_conn()
> cursor = conn.cursor()
> values = ', '.join(':%s' % i for i in range(1, len(target_fields) + 1))
> prepared_stm = 'insert into {tablename} ({columns}) values
> ({values})'.format(
> tablename=table,
> columns=', '.join(target_fields),
> values=values,
> )
> {code}
> *target_fields* default *None* will leads
>
> {code:java}
> len(target_fields)
> {code}
> and
> {code:java}
> ', '.join(target_fields)
> {code}
> fail
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)