"Unknown result" when running an insert statement on a hive database using pyhive and sqlalchemy

21 views Asked by At

I am trying to write a python application to insert data into a hive database. My python code looks something like this:

engine = create_engine('hive://node1:10000/default')
meta = MetaData()
conn = engine.connect()
statement = text("""INSERT INTO TABLE data (udid) VALUES ( :udid )""")
dbdata = { "udid": "12345" }
conn.execute(statement, dbdata)

As you can see if I tried to simplify this query as much as possible. node1 is the namenode of a hadoop cluster running on my computer as a series of virtual machines. The ThriftServer is running on port 10000 I am getting the following error:

thrift.Thrift.TApplicationException: ExecuteStatement failed: unknown result

Any ideas on what I am doing wrong?

UPDATE 1

I modified my logic to place the conn.execute() statement in a loop (I am trying to store real time data being generated by a sensor). The hive database stores two records before generating the above error.

This error only appears when debugging with VSCode. When running from the command line, I get no error messages ... but I also only get 2 records inserted in my table (I should be receiving several dozen records, at least)

0

There are 0 answers