python-glowplug 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-glowplug
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary:
5
5
  Home-page: https://github.com/jnu/python-glowplug
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-glowplug"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = ""
5
5
  authors = ["Joe Nudell <jnudell@hks.harvard.edu>"]
6
6
  readme = "README.md"
@@ -7,14 +7,18 @@ class MsSqlDriver(DbDriver):
7
7
 
8
8
  path: str
9
9
 
10
- def __init__(self, path: str, **kwargs):
10
+ maintenance_db: str
11
+
12
+ def __init__(self, path: str, maintenance_db: str = "master", **kwargs):
11
13
  """Initialize the driver.
12
14
 
13
15
  Args:
14
16
  path (str): The path to connect to the database.
17
+ maintenance_db (str, optional): The database to connect to for maintenance. Defaults to "master".
15
18
  """
16
19
  super().__init__(**kwargs)
17
20
  self.path = path
21
+ self.maintenance_db = maintenance_db
18
22
 
19
23
  async def exists(self) -> bool:
20
24
  """Check if the database exists."""
@@ -56,6 +60,7 @@ class MsSqlDriver(DbDriver):
56
60
  head, tail = self.path.split("/", 1)
57
61
  # Extract the database name from the tail
58
62
  database, query = tail.split("?", 1)
59
- # Re-join the query to the beginning of the path
60
- path = f"{head}/?{query}"
63
+ # Re-join the query to the beginning of the path, with the
64
+ # name of the maintenance database.
65
+ path = f"{head}/{self.maintenance_db}?{query}"
61
66
  return path, database
File without changes