1

I am trying to use bigtable emulator within googleapiclient.discovery.Resource module of python.

  • Bigtable emulator run on 127.0.0.1:8086

Bigtable Client service setup via discovery service:

http = httplib2.Http(None, timeout=http_timeout)
client=discovery.build('bigtableadmin', 'v2', http=_http)
_client._baseUrl = 127.0.0.1:8086

Following post request is sent by discovery:

http://127.0.0.1:8086/v2/projects/my_project/instances/my_instance/tables?alt=json

which eventually returns [Errno 54] Connection reset by peer.

I can utilise bigtable emulator with using google.cloud.bigtable.Client without any problem.

I can use local pubs emulator with same discovery service, and rest api seems to work fine but fails on bigtable emulator.

Does Bigtable Emulator supports post requests? Or emulator has limited usage with only google.cloud.bigtable.Client? I could not find any detail on emulator documentation.

ayyayyekokojambo
  • 1,165
  • 3
  • 13
  • 33
  • Could you elaborate on the way your are Using the Resource class? adding a code snippet with an specific method for a sample execution would be good to narrow down and follow replications. – sergio franco May 14 '20 at 13:12
  • thanks for the feedback, I added discovery service build. Same approach works with pubsub emulator and service client can send rest api calls to the emulator. But it does not work on bigtable. I started to think that bigtable emulator does not support rest api operations. – ayyayyekokojambo May 15 '20 at 11:10
  • I've found a couple of entries with a similar behavior, and I would say that the problem relies on the way that the Discovery library is managing the connection. I've tried with curl and I got quite the same error. https://stackoverflow.com/questions/8658118/when-is-java-io-ioexceptionconnection-reset-by-peer-thrown https://stackoverflow.com/questions/50839322/connect-from-java-app-to-google-cloud-bigtable-which-running-on-docker – sergio franco May 21 '20 at 00:24
  • I saw them. my guess is bigtable emulator does not support REST api calls. @sergiofranco – ayyayyekokojambo May 22 '20 at 07:18
  • 1
    from the docstring of `google.cloud.bigtable.Client`: "note:: Since the Cloud Bigtable API requires the gRPC transport, no ``_http`` argument is accepted by this class." – johnmcs Jun 05 '20 at 14:28

1 Answers1

1

According to the comment done above and as described here, since the Cloud Bigtable API requires the gRPC transport, no _http argument is accepted by this class.

Therefore, this would explain the error that your get

siamsot
  • 1,501
  • 1
  • 14
  • 20