()
| 143 | return bytes(response.json()["bytes"]).decode("utf-8") |
| 144 | |
| 145 | def main(): |
| 146 | # Initialize client session |
| 147 | create_session() |
| 148 | |
| 149 | name = "key_value_store_test" |
| 150 | |
| 151 | # Create collection and index |
| 152 | create_db(name) |
| 153 | create_index(name) |
| 154 | |
| 155 | # Create transaction and index vectors |
| 156 | print("Creating transaction and indexing vectors...") |
| 157 | |
| 158 | txn_id = create_transaction(name) |
| 159 | |
| 160 | try: |
| 161 | upsert(name, txn_id, "a", "Hello") |
| 162 | upsert(name, txn_id, "b", "World") |
| 163 | commit_transaction(name, txn_id) |
| 164 | except Exception: |
| 165 | abort_transaction(name, txn_id) |
| 166 | |
| 167 | |
| 168 | a = lookup(name, "a") |
| 169 | b = lookup(name, "b") |
| 170 | |
| 171 | print(f"Expected: \"Hello\", Found: \"{a}\"") |
| 172 | print(f"Expected: \"World\", Found: \"{b}\"") |
| 173 | |
| 174 | |
| 175 | if __name__ == "__main__": |
no test coverage detected