quintoandar / hive-metastore-client

A client for connecting and running DDLs on hive metastore.
Apache License 2.0
52 stars 15 forks source link

ColumnBuilder has no attribute 'write' #32

Closed rotten closed 3 years ago

rotten commented 3 years ago

I could use a hint as to what might throw this error out of the Thrift client. I'm using thrift version 0.13.0 with this.

I'm mostly following the examples for building a table.

Traceback (most recent call last):
  File "./load_metastore.py", line 126, in <module>
    mc.create_table(my_table)
  File "/home/rotten/.virtualenvs/load_metastore/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ThriftHiveMetastore.py", line 2632, in create_table
    self.send_create_table(tbl)
  File "/home/rotten/.virtualenvs/load_metastore/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ThriftHiveMetastore.py", line 2639, in send_create_table
    args.write(self._oprot)
  File "/home/rotten/.virtualenvs/load_metastore/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ThriftHiveMetastore.py", line 20777, in write
    self.tbl.write(oprot)
  File "/home/rotten/.virtualenvs/load_metastore/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ttypes.py", line 5253, in write
    self.sd.write(oprot)
  File "/home/rotten/.virtualenvs/load_metastore/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ttypes.py", line 4897, in write
    iter170.write(oprot)
AttributeError: 'ColumnBuilder' object has no attribute 'write'
LucasMMota commented 3 years ago

It looks to me that you're missing to build the object returned in the builder. You are probably doing this:

ColumnBuilder("id", "string", "col comment")

instead of this (the right way):

ColumnBuilder("id", "string", "col comment").build()

The build method will return the Thrift object that the client requires.

rotten commented 3 years ago

Indeed! That was it. Thanks!