Skip to content

AttributeError: 'NoneType' object has no attribute 'mutateRows' #3

Closed

Description

@itayB

I'm trying to use aiohappybase with our old HBase 0.94 :(

Here is my code:

connection = Connection(host="localhost", port=9091, compat="0.94")
table = connection.table(TABLE_NAME)
batch = table.batch()
await batch.counter_inc(day_key, qualifier, value=value)
await batch.counter_inc(month_key, qualifier, value=value)
await batch.send()

and I'm getting an exception on the 3rd row: batch = table.batch():

Traceback (most recent call last):
  File "/indexer/sink.py", line 39, in <module>
    loop.run_until_complete(write_to_hbase([]))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/indexer/sink.py", line 23, in write_to_hbase
    batch = table.batch()
  File "/indexer/venv/lib/python3.8/site-packages/aiohappybase/table.py", line 569, in batch
    return Batch(table=self, **kwargs)
  File "/indexer/venv/lib/python3.8/site-packages/aiohappybase/batch.py", line 304, in __init__
    self._mutations = MutationBatcher(table, timestamp, batch_size, wal)
  File "/indexer/venv/lib/python3.8/site-packages/aiohappybase/batch.py", line 99, in __init__
    mut_rows = self._table.client.mutateRows
AttributeError: 'NoneType' object has no attribute 'mutateRows'

What am I missing here?

UPDATE:
I've found that it is broken in both v1.4.0 + v1.3.0 but it DOES work in v1.2.0.
On the other hand, seems like v1.2.0 doesn't support counter_inc :(

Activity

  1. itayB commented on Apr 22, 2021

    @itayB
    Author

    found it. I had to add:

    await connection.open()
    

    after my first row :)

  2. aiudirog commented on Apr 22, 2021

    @aiudirog
    Member

    Good catch, I'll see about making the client value an object which raises an error instead of it being None.

  3. itayB commented on Apr 25, 2021

    @itayB
    Author

    It still doesn't work :(
    I'm getting the following exception:

    thriftpy2.thrift.TApplicationException: <exception str() failed>
    

    Trying to add a breakpoint and I see:

    TApplicationException(type=1, message=b"Invalid method name: 'incrementRows'")
    

    image

    my HBase thrift runs with:

    hbase-daemon.sh start thrift2 -p 9091
    

    what am I missing now?

  4. aiudirog commented on Apr 25, 2021

    @aiudirog
    Member

    My guess is that mutateRows incrementRows isn't available in HBase 0.94. I'll dig into this when I get a chance.

    Edit: the 0.94 branch shows that it should be there. I'll see if I can set up a test environment and try it out.

  5. itayB commented on Apr 26, 2021

    @itayB
    Author

    thanks, @aiudirog.
    Actually, I've tried several functions (put, get tables, inc) and none of them work.
    I've reproduced it locally with HBase in docker (and in my real HBase cluster)

    from aiohappybase import Connection
    
    
    async def main():
        connection = Connection(host="localhost", port=9091, timeout=10_000, compat="0.94")
        await connection.open()
        tables = await connection.tables()
        print(tables)
        connection.close()
    
    
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    

    I also tried to run with the regular package (happybase) and got the same error :(

  6. itayB commented on Apr 26, 2021

    @itayB
    Author

    I think that I found the issue after trying to contribute here. I ran thrift2 by:

    hbase-daemon.sh start thrift2 -p 9090
    

    After changing it to thrift (1) the code above is working:

    hbase-daemon.sh start thrift -p 9090
    

    Isn't thrift2 newer? is there support for thrift2? (our production HBase cluster expose Thrift2)

  7. aiudirog commented on Apr 26, 2021

    @aiudirog
    Member

    Aha I completely missed that you are using the thrift2 API. Yes that is currently unsupported as this codebase isn't much different than the original happybase.

    I think you may be the first to actually require using it and it would be really useful to get the support included. It is probably going to be a lot of work as I recall the API being quite different.

  8. aiudirog commented on Apr 27, 2021

    @aiudirog
    Member

    While I don't use the thrift2 API at work, I would like to get it integrated. I've started a new branch on my fork here for any work: https://github.com/aiudirog/aiohappybase/tree/thrift2

    The API is different enough that I think it warrants to separate implementations, but I'll have to explore it a bit before I'm 100% sure.

  9. aiudirog commented on Apr 27, 2021

    @aiudirog
    Member

    I'm going to close this in favor of having two dedicated issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions