python-glowplug 0.2.3__py3-none-any.whl → 0.2.4__py3-none-any.whl

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.
glowplug/mssql.py CHANGED
@@ -33,7 +33,7 @@ class MsSqlDriver(DbDriver):
33
33
  text("SELECT name FROM sys.databases WHERE name = :db"),
34
34
  {"db": database},
35
35
  )
36
- row = await result.fetchone()
36
+ row = result.fetchone()
37
37
  return row is not None
38
38
 
39
39
  async def create(self) -> None:
@@ -42,12 +42,12 @@ class MsSqlDriver(DbDriver):
42
42
  path, database = self._split_path()
43
43
  # Connect to the database-less path
44
44
  engine = create_async_engine(f"mssql+aioodbc://{path}")
45
- # Create a raw connection with autocommit on.
45
+ # Need to run this with autocommit=True to avoid a transaction error
46
46
  # See: https://stackoverflow.com/a/42008664
47
- conn = await engine.raw_connection()
48
- conn.driver_connection.autocommit = True
49
- await conn.driver_connection.execute(f"CREATE DATABASE {database}")
50
- conn.close()
47
+ async with engine.connect() as conn:
48
+ await conn.execute(
49
+ text(f"CREATE DATABASE {database}").execution_options(autocommit=True)
50
+ )
51
51
 
52
52
  @property
53
53
  def async_uri(self) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-glowplug
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary:
5
5
  Home-page: https://github.com/jnu/python-glowplug
6
6
  License: MIT
@@ -1,9 +1,9 @@
1
1
  glowplug/__init__.py,sha256=vOFfxzKjr7djsdQcWi3x4IKMgcNHYSZgwyld5Xzezws,195
2
2
  glowplug/base.py,sha256=LTBSCkYLO_xJZwDDjKA8ro9KSbMHdKNtWBAoNecJmGE,2845
3
- glowplug/mssql.py,sha256=71yT-u0kp3RdZB2LzFBRcjT6nBWFBND7SIVlNgALXAU,2596
3
+ glowplug/mssql.py,sha256=R1NGLfZMJ0jGd55TscOkDLarPCy1HPNRcJz-zGce_CE,2600
4
4
  glowplug/pg.py,sha256=4Hw2WG33UzgYyJtWLv8QWZzHhzzsM34TyDuObtxvNmI,2600
5
5
  glowplug/sqlite.py,sha256=DEJ8lYP8ZPemeGezTovs8WISGaVyUfwTIqiwMz3FPdU,1020
6
- python_glowplug-0.2.3.dist-info/LICENSE,sha256=HvAzro26TfbigQ3ppmyagEGHIr_UtyQDfU8muTAqWFU,1060
7
- python_glowplug-0.2.3.dist-info/METADATA,sha256=kd96CJnjwRu3auGYaAIngxZUdRmFw7WbVYK3pFU0Uq0,1257
8
- python_glowplug-0.2.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
9
- python_glowplug-0.2.3.dist-info/RECORD,,
6
+ python_glowplug-0.2.4.dist-info/LICENSE,sha256=HvAzro26TfbigQ3ppmyagEGHIr_UtyQDfU8muTAqWFU,1060
7
+ python_glowplug-0.2.4.dist-info/METADATA,sha256=Ea4zqBHLfB07AsZPw_IVSu6p5G1a97Aqef_ACWuT3H0,1257
8
+ python_glowplug-0.2.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
9
+ python_glowplug-0.2.4.dist-info/RECORD,,