Closed gabrysiaolsz closed 2 days ago
gapic-generator
pip install google-cloud-datacatalog-lineage==0.3.9
LineageClient
metadata
Sequence[Tuple[str, str]]
Sequence[Tuple[str, Union[str, bytes]]]
Sending a pair of str, when the first one has a suffix of "-bin" causes errors:
str
client.process_open_lineage_run_event( request, metadata=[ ('x-goog-ext-512598505-bin', '\n\x08BIGQUERY\x12\x05LOAD1'), ] )
E TypeError: Binary metadata key="x-goog-ext-512598505-bin" expected bytes, got <class 'str'> src/python/grpcio/grpc/_cython/_cygrpc/metadata.pyx.pxi:45: TypeError
Sending a pair of str, bytes succeeds:
str, bytes
client.process_open_lineage_run_event( request, metadata=[ ('x-goog-ext-512598505-bin', b'\n\x08BIGQUERY\x12\x05LOAD1'), ] )
So the type annotation should be Sequence[Tuple[str, Union[str, bytes]]], to avoid confusion and time wasted on debbuging. The examples here also show to send str, bytes.
Environment details
gapic-generator
version: N/A, bug in already generated librarySteps to reproduce
pip install google-cloud-datacatalog-lineage==0.3.9
(as a quick way of getting a generated client)LineageClient
metadata
in API methods isSequence[Tuple[str, str]]
, but in reality it should beSequence[Tuple[str, Union[str, bytes]]]
.Failing Code example
Sending a pair of
str
, when the first one has a suffix of "-bin" causes errors:Stack trace
Working Code example
Sending a pair of
str, bytes
succeeds:So the type annotation should be
Sequence[Tuple[str, Union[str, bytes]]]
, to avoid confusion and time wasted on debbuging. The examples here also show to sendstr, bytes
.