removed upsert

This commit is contained in:
ari committed 2022-08-16 20:48:13 -04:00
1 parent c67d1bd32f
commit 9bafbf4e8c
4 files changed
+8 -18

No files matched your search

+2 -11
View File
@@ -72,7 +72,7 @@ class AutomationDBConnection:
"""
)
def upsert_automations(self, automations: List[ExtenededAutomation]):
def insert_automations(self, automations: List[ExtenededAutomation]):
with self.get_cur() as cur:
for automation in automations:
cur.execute(
@@ -86,16 +86,7 @@ class AutomationDBConnection:
"{automation.source_file_type}",
"{automation.configuration_key}",
"{encode_auto(automation)}"
)
ON CONFLICT DO UPDATE SET
alias = "{automation.alias}",
description = "{automation.description}",
mode = "{automation.mode}",
source_file = "{automation.source_file.absolute()}",
source_file_type = "{automation.source_file_type}",
configuration_key = "{automation.configuration_key}",
rest = "{encode_auto(automation)}"
);
""",
)
+1 -1
View File
@@ -46,7 +46,7 @@ class AutomationManager:
for config_key, p in extract_automation_paths(self.hass_config):
try:
automations = list(load_automation_path(p, config_key, self.tag_manager))
self.db.upsert_automations(automations)
self.db.insert_automations(automations)
except InvalidAutomationFile as e:
logger.warning(e)
errors.append(e)