-
Notifications
You must be signed in to change notification settings - Fork 552
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
INSERT/executemany fails #50
Comments
Yeah this is a bug, though I'm more inclined to just delete executemany since it's pointlessly inefficient as you mention. You can insert a batch of rows using this syntax: It would be neat to handle that automatically, but it can't be done cleanly in |
i have the same problem too on python3.7 about executemany fails
/usr/local/python37/lib/python3.7/site-packages/pyhive/common.py in executemany(self, operation, seq_of_parameters) /usr/local/python37/lib/python3.7/site-packages/pyhive/hive.py in _fetch_more(self) ProgrammingError: (pyhive.exc.ProgrammingError) No result set [SQL: 'INSERT INTO TABLE finally i got one row on this hive table |
See #250 for a monkey patch, which works, but is hopelessly inefficient, as mentioned. You can also generate a multiline SQL statement and execute using the cursor, which is what I ended up doing (but couldn't find a way to parameterise the string). Finally, probably the best option, is to write your CSV in to HDFS and use the CSV batch import in Hive. |
Any fix / workaround for Hive on inserting a batch of data? |
Here's a workaround - https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-chunking |
Another workaround using to_sql's |
It works!Thanks! |
I am trying to use pandas to insert a batch of data to a Hive table and it bombs after the first insert.
PyHive seems to try to get a result set after each insert and does not get one, breaking the executemany:
But there is another issue, which is that this is not performant at all in the way the batch insert is generated. It generates a separate insert per row, which causes Hive to create a MR job for each row. Is there a better way to handle a batch insert like this?
The text was updated successfully, but these errors were encountered: