We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 324d128 commit 297576aCopy full SHA for 297576a
rctab/routers/accounting/usage.py
@@ -78,18 +78,13 @@ async def insert_usage(all_usage: AllUsage) -> None:
78
all_usage: Usage data to insert.
79
"""
80
usage_query = insert(accounting_models.usage)
81
- update_dict = {c.name: c for c in usage_query.excluded if not c.primary_key}
82
- on_duplicate_key_stmt = usage_query.on_conflict_do_update(
83
- index_elements=inspect(accounting_models.usage).primary_key,
84
- set_=update_dict,
85
- )
86
87
logger.info("Inserting usage data")
88
insert_start = datetime.datetime.now()
89
90
await executemany(
91
database,
92
- on_duplicate_key_stmt,
+ usage_query,
93
values=[i.model_dump() for i in all_usage.usage_list],
94
)
95
logger.info("Inserting usage data took %s", datetime.datetime.now() - insert_start)
0 commit comments