Bart-art opened a new issue #17632:
URL: https://github.com/apache/airflow/issues/17632
<!--
Welcome to Apache Airflow!
Please complete the next sections or the issue will be closed.
-->
**Apache Airflow version**: 2.1.0
<!-- AIRFLOW VERSION IS MANDATORY -->
**OS**: Raspbian GNU/Linux 10 (buster)
<!-- MANDATORY! You can get it via `cat /etc/oss-release` for example -->
**Apache Airflow Provider versions**: apache-airflow-providers-sqlite==1.0.2
<!-- You can use `pip freeze | grep apache-airflow-providers` (you can leave
only relevant ones)-->
**Deployment**: Virtualenv
<!-- e.g. Virtualenv / VM / Docker-compose / K8S / Helm Chart / Managed
Airflow Service -->
<!-- Please include your deployment tools and versions: docker-compose, k8s,
helm, etc -->
**What happened**:
When using the insert_rows function of the sqlite hook the generated
parametrized sql query has an invalid syntax. It will generate queries with the
%s placeholder which result in the following error:
*Query*: INSERT INTO example_table (col1, col2) VALUES (%s,%s)
*Error*:
sqlite3.OperationalError: near "%": syntax error
*Stacktrace*:
File
"/home/airflow/.pyenv/versions/3.8.10/envs/airflow_3.8.10/lib/python3.8/site-packages/airflow/hooks/dbapi.py",
line 307, in insert_rows
cur.execute(sql, values)
I replaced the placeholder with "?" in the _generate_insert_sql function
DbApiHook as a test. This solved the issue.
<!-- Please include exact error messages if you can -->
**What you expected to happen**:
Every inherited method of the DbApiHook should work for the SqliteHook.
Using the insert_rows method should generate the correct parametrized query and
insert rows as expected.
<!-- What do you think went wrong? -->
**How to reproduce it**:
1. Create an instance of the SqliteHook
2. Use the insert_rows method of the SqliteHook
<!--
As minimally and precisely as possible. Keep in mind we do not have access
to your cluster or dags.
If this is a UI bug, please provide a screenshot of the bug or a link to a
youtube video of the bug in action
You can include images/screen-casts etc. by drag-dropping the image here.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]