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 VariantDatabaseHandler(DatabaseMetadataContainerController):
@ -9,11 +8,9 @@ class VariantDatabaseHandler(DatabaseMetadataContainerController):
def __init__(self):
super().__init__(SQLQueryFactory(table = "variants",
fields = {
"id": "text",
"name": "text",
"hardware_type": "text",
"definition": "text",
"version": "text",
"setting_version": "text"
}))
self.container_type = InstanceContainer