Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with oracle batch insertion query #243

Open
RationalRank opened this issue Apr 18, 2019 · 1 comment
Open

Issue with oracle batch insertion query #243

RationalRank opened this issue Apr 18, 2019 · 1 comment

Comments

@RationalRank
Copy link

RationalRank commented Apr 18, 2019

The raw query syntax for batch insertion in Oracle would be

INSERT ALL
  INTO table (column1, column2, column_n) VALUES (value_1, value_2, value_3)
  INTO table (column1, column2, column_n) VALUES (value_1, value_2, value_3)
  INTO table (column1, column2, column_n) VALUES (value_1, value_2, value_3)
SELECT * FROM dual;

This is the code below which i tried to generate query for bulk insert

oracle_query = OracleQuery.into(table_to_insert).columns(*raw_query_col_names)
for each_row in batch:
    # do_something
    oracle_query = oracle_query.insert(tuple(each_row_to_insert))

But the generated raw query is:
INSERT INTO "table_name" ("column_1","column_2") VALUES ('value_1','value_2'),('value_1','value_2'),('value_1','value_2')

Since it is an incorrect query, I get the error ORA-00933: SQL command not properly ended

Does it have support for this out of the box?

@twheys
Copy link
Contributor

twheys commented Jul 3, 2019

This particular feature is not currently implemented, no, but if you'd like to try your hand at it please feel free to raise a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants