Use SQLQueryFactory for container DB

Needed to add a Filter possibility to facilitate that
Created a Simple UserString class which can be used as:

```py
        sql_filter = SQLFilter(f"SELECT {{}} FROM table_name WHERE id = ?")
        cursor.execute(sql_filter)  # Will execute: SELECT * FROM table_name WHERE id = ?
        cursor.execute(sql_filter["id", "name"])  # Will execute: SELECT id, name FROM table_name WHERE id = ?

```

Contributes to CURA-6096
This commit is contained in:
jelle Spijker 2021-09-02 16:55:24 +02:00 committed by Jelle Spijker
parent 4067d9d607
commit 571a051041
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A
3 changed files with 0 additions and 9 deletions

View file

@ -1,6 +1,5 @@
from UM.Settings.SQLQueryFactory import SQLQueryFactory
from UM.Settings.DatabaseContainerMetadataController import DatabaseMetadataContainerController
from UM.Settings.InstanceContainer import InstanceContainer
class IntentDatabaseHandler(DatabaseMetadataContainerController):
@ -9,7 +8,6 @@ class IntentDatabaseHandler(DatabaseMetadataContainerController):
def __init__(self) -> None:
super().__init__(SQLQueryFactory(table = "intents",
fields = {
"id": "text",
"name": "text",
"quality_type": "text",
"intent_category": "text",
@ -19,4 +17,3 @@ class IntentDatabaseHandler(DatabaseMetadataContainerController):
"version": "text",
"setting_version": "text"
}))
self.container_type = InstanceContainer