Skip to content

Commit

Permalink
Replace deprecated use of URL() by URL.create()
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Feb 7, 2025
1 parent abb82b4 commit 312cb4b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion spinetoolbox/spine_db_editor/widgets/custom_qwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class OpenSQLiteFileButton(OpenFileButton):

def __init__(self, file_path, progress, db_editor):
super().__init__(file_path, progress, db_editor)
self.url = URL("sqlite", database=self.file_path)
self.url = URL.create("sqlite", database=self.file_path)

@Slot(bool)
def open_file(self, checked=False):
Expand Down
2 changes: 1 addition & 1 deletion spinetoolbox/spine_db_editor/widgets/spine_db_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def import_from_json(self, file_path):
self.msg.emit(f"File {filename} successfully imported.")

def import_from_sqlite(self, file_path):
url = URL("sqlite", database=file_path)
url = URL.create("sqlite", database=file_path)
filename = os.path.split(file_path)[1]
try:
db_map = DatabaseMapping(url)
Expand Down
4 changes: 2 additions & 2 deletions spinetoolbox/spine_db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ def _is_url_available(self, url, logger):

def export_to_sqlite(self, file_path, data_for_export, caller):
"""Exports given data into SQLite file."""
url = URL("sqlite", database=file_path)
url = URL.create("sqlite", database=file_path)
if not self._is_url_available(url, caller):
return
with DatabaseMapping(url, create=True) as db_map:
Expand All @@ -1679,7 +1679,7 @@ def export_to_json(file_path, data_for_export, caller):
def export_to_excel(file_path, data_for_export, caller):
"""Exports given data into Excel file."""
# NOTE: We import data into an in-memory Spine db and then export that to excel.
url = URL("sqlite", database="")
url = URL.create("sqlite", database="")
with DatabaseMapping(url, create=True) as db_map:
count, errors = import_data(db_map, **data_for_export, unparse_value=dump_db_value)
file_name = os.path.split(file_path)[1]
Expand Down

0 comments on commit 312cb4b

Please sign in to comment.