mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00

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
16 lines
791 B
Python
16 lines
791 B
Python
from UM.Settings.SQLQueryFactory import SQLQueryFactory
|
|
from UM.Settings.DatabaseContainerMetadataController import DatabaseMetadataContainerController
|
|
|
|
|
|
class VariantDatabaseHandler(DatabaseMetadataContainerController):
|
|
"""The Database handler for Variant containers"""
|
|
|
|
def __init__(self):
|
|
super().__init__(SQLQueryFactory(table = "variants",
|
|
fields = {
|
|
"name": "text",
|
|
"hardware_type": "text",
|
|
"definition": "text",
|
|
"version": "text",
|
|
"setting_version": "text"
|
|
}))
|