Perf: Polars-Import lazy gemacht (nur bei DB-Nutzung laden)
Polars wird nicht mehr beim App-Start importiert, sondern erst wenn eine Datenbankabfrage tatsächlich ausgeführt wird. Beschleunigt den Kaltstart der Anwendung. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,6 @@ from PySide6.QtCore import QThread, Signal, Qt
|
||||
|
||||
from ui.PostgreSqlConfigDialog_ui import Ui_PostgreSqlConfigDialog
|
||||
|
||||
import polars as pl
|
||||
|
||||
|
||||
class DatabaseTestThread(QThread):
|
||||
"""Thread für den Datenbankverbindungstest."""
|
||||
@@ -18,6 +16,7 @@ class DatabaseTestThread(QThread):
|
||||
|
||||
def run(self):
|
||||
"""Führt den Datenbanktest in einem separaten Thread aus."""
|
||||
import polars as pl
|
||||
try:
|
||||
timeout = self.connection_data.get("timeout", 10)
|
||||
uri = (
|
||||
|
||||
@@ -10,7 +10,6 @@ import time
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import polars as pl
|
||||
from PySide6.QtCore import QThread, Signal, Qt
|
||||
from PySide6.QtWidgets import QMessageBox, QProgressDialog
|
||||
|
||||
@@ -31,6 +30,7 @@ class DatabaseQueryThread(QThread):
|
||||
self.connection_string = connection_string
|
||||
|
||||
def run(self):
|
||||
import polars as pl
|
||||
try:
|
||||
df = pl.read_database_uri(self.sql_query, self.connection_string, engine="connectorx").sort(
|
||||
["reporttyp_bez", "report_bez", "repfile_bez"]
|
||||
@@ -208,6 +208,7 @@ class DatabaseMixin:
|
||||
Returns:
|
||||
list[TreeNode]: Liste der erstellten Root-Nodes
|
||||
"""
|
||||
import polars as pl
|
||||
try:
|
||||
start_time = time.time()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user