Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Jan 20, 2024
1 parent 39d154d commit 8162b62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion persistence/cosmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def call_aget(self, call_id: UUID) -> Optional[CallModel]:
items = self._db.query_items(
enable_cross_partition_query=True,
query="SELECT * FROM c WHERE c.call_id = @call_id",
parameters=[{"name": "@call_id", "value": call_id.hex}],
parameters=[{"name": "@call_id", "value": str(call_id)}],
)
except CosmosHttpResponseError as e:
_logger.error(f"Error accessing CosmosDB: {e}")
Expand Down
6 changes: 3 additions & 3 deletions persistence/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def call_aget(self, call_id: UUID) -> Optional[CallModel]:
async with self._use_db() as db:
cursor = await db.execute(
f"SELECT data FROM {self._config.table} WHERE id = ?",
(call_id.hex,),
(str(call_id),),
)
row = await cursor.fetchone()
if row:
Expand All @@ -48,7 +48,7 @@ async def call_aset(self, call: CallModel) -> bool:
await db.execute(
f"INSERT OR REPLACE INTO {self._config.table} VALUES (?, ?, ?, ?)",
(
call.call_id.hex, # id
str(call.call_id), # id
call.phone_number, # phone_number
json.dumps(data), # data
call.created_at.isoformat(), # created_at
Expand Down Expand Up @@ -101,7 +101,7 @@ async def _init_db(self, db: SQLiteConnection):
await db.execute("PRAGMA journal_mode=WAL")
# Create table
await db.execute(
f"CREATE TABLE IF NOT EXISTS {self._config.table} (id VARCHAR(32) PRIMARY KEY, phone_number TEXT, data TEXT, created_at TEXT)"
f"CREATE TABLE IF NOT EXISTS {self._config.table} (id VARCHAR(36) PRIMARY KEY, phone_number TEXT, data TEXT, created_at TEXT)"
)
# Create indexes
await db.execute(
Expand Down

0 comments on commit 8162b62

Please sign in to comment.