MCPcopy Index your code
hub / github.com/feast-dev/feast / main

Function main

sdk/python/feast/infra/utils/hbase_utils.py:179–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177
178
179def main():
180 from feast.infra.key_encoding_utils import serialize_entity_key
181 from feast.protos.feast.types.EntityKey_pb2 import EntityKey
182 from feast.protos.feast.types.Value_pb2 import Value
183
184 pool = ConnectionPool(
185 host="localhost",
186 port=9090,
187 size=2,
188 )
189 with pool.connection() as connection:
190 table = connection.table("test_hbase_driver_hourly_stats")
191 row_keys = [
192 serialize_entity_key(
193 EntityKey(
194 join_keys=["driver_id"], entity_values=[Value(int64_val=1004)]
195 ),
196 entity_key_serialization_version=3,
197 ).hex(),
198 serialize_entity_key(
199 EntityKey(
200 join_keys=["driver_id"], entity_values=[Value(int64_val=1005)]
201 ),
202 entity_key_serialization_version=3,
203 ).hex(),
204 serialize_entity_key(
205 EntityKey(
206 join_keys=["driver_id"], entity_values=[Value(int64_val=1024)]
207 ),
208 entity_key_serialization_version=3,
209 ).hex(),
210 ]
211 rows = table.rows(row_keys)
212
213 for _, row in rows:
214 for key, value in row.items():
215 col_name = bytes.decode(key, "utf-8").split(":")[1]
216 print(col_name, value)
217 print()
218
219
220if __name__ == "__main__":

Callers 1

hbase_utils.pyFile · 0.70

Calls 4

serialize_entity_keyFunction · 0.90
rowsMethod · 0.80
decodeMethod · 0.80
tableMethod · 0.45

Tested by

no test coverage detected