()
| 177 | |
| 178 | |
| 179 | def 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 | |
| 220 | if __name__ == "__main__": |
no test coverage detected