pum 1.1.10__py3-none-any.whl → 1.1.15__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.
pum/cli.py CHANGED
@@ -351,7 +351,6 @@ def cli() -> int: # noqa: PLR0912
351
351
  max_version=args.max_version,
352
352
  roles=args.roles,
353
353
  grant=args.grant,
354
- demo_data=args.demo_data,
355
354
  beta_testing=args.beta_testing,
356
355
  )
357
356
  conn.commit()
pum/config_model.py CHANGED
@@ -36,10 +36,11 @@ class ParameterDefinitionModel(PumCustomBaseModel):
36
36
  class HookModel(PumCustomBaseModel):
37
37
  """
38
38
  HookModel represents a migration hook configuration.
39
+ It can either execute a file (SQL or Python script) or run inline SQL code.
39
40
 
40
41
  Attributes:
41
- file: Optional path to a SQL file to execute as a hook.
42
- code: Optional Python code to execute as a hook.
42
+ file: Optional path to a SQL file or a Python script to execute as a hook.
43
+ code: Optional SQL code to execute as a hook.
43
44
  """
44
45
 
45
46
  file: Optional[str] = None
pum/pum_config.py CHANGED
@@ -262,7 +262,7 @@ class PumConfig:
262
262
 
263
263
  def __del__(self):
264
264
  # Cleanup temporary directories and sys.path modifications
265
- if self.dependency_path:
265
+ if self.dependency_path and sys.path:
266
266
  # Remove from sys.path if present
267
267
  sys.path = [p for p in sys.path if p != str(self.dependency_path)]
268
268
  # Remove the directory if it exists and is a TemporaryDirectory
pum/sql_content.py CHANGED
@@ -161,6 +161,10 @@ class SqlContent:
161
161
  sql: The SQL statement to execute or a path to a SQL file.
162
162
 
163
163
  """
164
+ if not isinstance(sql, (str, psycopg.sql.SQL, Path)):
165
+ raise PumSqlError(
166
+ f"SQL must be a string, psycopg.sql.SQL object or a Path object, not {type(sql)}."
167
+ )
164
168
  self.sql = sql
165
169
 
166
170
  def validate(self, parameters: dict | None) -> bool:
pum/upgrader.py CHANGED
@@ -51,7 +51,6 @@ class Upgrader:
51
51
  max_version: str | packaging.version.Version | None = None,
52
52
  roles: bool = False,
53
53
  grant: bool = False,
54
- demo_data: str | None = None,
55
54
  beta_testing: bool = False,
56
55
  commit: bool = False,
57
56
  ) -> None:
@@ -71,8 +70,6 @@ class Upgrader:
71
70
  If True, roles will be created.
72
71
  grant:
73
72
  If True, permissions will be granted to the roles.
74
- demo_data:
75
- The name of the demo data to load. If None, no demo data is loaded.
76
73
  beta_testing:
77
74
  If True, the module is installed in beta testing mode.
78
75
  This means that the module will not be able to receive any future updates.
@@ -80,11 +77,6 @@ class Upgrader:
80
77
  commit:
81
78
  If True, the changes will be committed to the database.
82
79
  """
83
- if demo_data and demo_data not in self.config.demo_data():
84
- raise PumException(
85
- f"Demo data '{demo_data}' not found in the configuration. Available demo data: {self.config.demo_data()}"
86
- )
87
-
88
80
  if self.schema_migrations.exists(connection):
89
81
  msg = (
90
82
  f"Schema migrations table {self.config.config.pum.migration_table_schema}.pum_migrations already exists. "
@@ -119,15 +111,6 @@ class Upgrader:
119
111
  parameters=parameters,
120
112
  )
121
113
 
122
- if demo_data:
123
- demo_data_file = self.config.base_path / self.config.demo_data()[demo_data]
124
- logger.info("Installing demo data from %s", demo_data_file)
125
- SqlContent(sql=demo_data_file).execute(
126
- connection=connection,
127
- commit=False,
128
- parameters=parameters_literals,
129
- )
130
-
131
114
  for post_hook in self.config.post_hook_handlers():
132
115
  post_hook.execute(connection=connection, commit=False, parameters=parameters)
133
116
 
@@ -152,6 +135,7 @@ class Upgrader:
152
135
  parameters: dict | None = None,
153
136
  ) -> None:
154
137
  """Install demo data for the module.
138
+
155
139
  Args:
156
140
  connection: The database connection to use.
157
141
  name: The name of the demo data to install.
@@ -180,4 +164,6 @@ class Upgrader:
180
164
  for post_hook in self.config.post_hook_handlers():
181
165
  post_hook.execute(connection=connection, commit=False, parameters=parameters)
182
166
 
167
+ connection.commit()
168
+
183
169
  logger.info("Demo data '%s' installed successfully.", name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pum
3
- Version: 1.1.10
3
+ Version: 1.1.15
4
4
  Summary: Pum stands for "Postgres Upgrades Manager". It is a Database migration management tool very similar to flyway-db or Liquibase, based on metadata tables.
5
5
  Author-email: Denis Rouzaud <denis@opengis.ch>
6
6
  License-Expression: GPL-2.0-or-later
@@ -1,23 +1,22 @@
1
1
  pum/__init__.py,sha256=P-NHd6_SYpk9aypefLI62QCZ3f5APOMCwSzrFFCKAew,759
2
2
  pum/changelog.py,sha256=yDc5swmMd5gb2vCEAlenoq5gs-ZEGc4uXicBtiGxkOk,3692
3
3
  pum/checker.py,sha256=GT2v7793HP1g94dv0mL6CHtQfblQwAyeFHEWCy44lkc,14379
4
- pum/cli.py,sha256=mQtspJUYp6TwKfU6x0L5ke9q_pMxrf9Du8xd2bOtREA,14317
5
- pum/config_model.py,sha256=piSQBYp29gnzqmtN50_OUw5o9d7Q5dEzj4q6G7cIFik,6396
4
+ pum/cli.py,sha256=p5dMF4PyaM9iKpjd5QQATJLEZRiwhGDjB0oFElibwjE,14275
5
+ pum/config_model.py,sha256=l8PmaP_UJ5gbZH-p8EcE8W4J1wMhS0wPPr01a8wKlsA,6492
6
6
  pum/dependency_handler.py,sha256=AVeemsh6zUumRJKbRLRwP_FRC0x3K16TJiK2i9ogvn0,3861
7
7
  pum/dumper.py,sha256=EJZ8T44JM0GKgdqw1ENOfhZ-RI89OQ4DNdoTZKtLdEw,3404
8
8
  pum/exceptions.py,sha256=xyzzY4ht1nKfrVt59Giulflpmu83nJhxoTygrqiqPlw,1137
9
9
  pum/hook.py,sha256=5MrVa6Xr0o28RfsXylGDatlM_vOKfKtGJmhYx8crC94,9541
10
10
  pum/info.py,sha256=CGj-Lt4Y2l2ymAl3OFqCWfJD5xZF4aaUSztAiSKwgE4,1395
11
11
  pum/parameter.py,sha256=qdbWk3WZc419AW-qwGMxlgc-7GEhdwIoPBnDk6UsVZU,2485
12
- pum/pum_config.py,sha256=xTEdYh-628pnkoqH56NoPIuhIQauc1d6hksM8hcCCU4,11232
12
+ pum/pum_config.py,sha256=bnL3rxgd7YNLD9u8Yyl7lNPxt7YtRXC0cpDP-l1Rw9w,11245
13
13
  pum/role_manager.py,sha256=yr-fmytflGqANY3IZIpgJBoMOK98ynTWfemIBhAy79A,10131
14
14
  pum/schema_migrations.py,sha256=MCA40pCptwWeoZQuZb3zyvbLDU7I1YdRbr1Hgpe9hYg,10481
15
- pum/sql_content.py,sha256=KoAa3CNVH_Hh6Z3FxpCYJCsG1NEiCRpfzlfP8wPFZHE,10414
16
- pum/upgrader.py,sha256=eWjvdj8OpYLOf-ExLEkOoEqf1UjGWzNRXw0ztkoysGU,7050
17
- pum/conf/pum_config_example.yaml,sha256=_nwV_7z6S_Se-mejh_My0JFLY-A0Q4nigeLGPZAfcqg,424
18
- pum-1.1.10.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
19
- pum-1.1.10.dist-info/METADATA,sha256=YYJBkXCWiiV3zhPlSHb0pTeBlnbJ8mY6f66TYULtUIk,3139
20
- pum-1.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- pum-1.1.10.dist-info/entry_points.txt,sha256=U6dmxSpKs1Pe9vWiR29VPhJMDjrmZeJCSxvfLGR8BD4,36
22
- pum-1.1.10.dist-info/top_level.txt,sha256=ddiI4HLBhY6ql-NNm0Ez0JhoOHdWDIzrHeCdHmmagcc,4
23
- pum-1.1.10.dist-info/RECORD,,
15
+ pum/sql_content.py,sha256=-0h3caJlvkyEjZwjPVrKh5ZYaDctC-5lklBvZ-zgRzA,10620
16
+ pum/upgrader.py,sha256=5o3d-RoZoUifw4POHRe2map2ik1FFe8SagGSa1reQUg,6333
17
+ pum-1.1.15.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
18
+ pum-1.1.15.dist-info/METADATA,sha256=gES-97iyHql3JwuT7IjVxyTbTgDsL16rwICvpQUq-04,3139
19
+ pum-1.1.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ pum-1.1.15.dist-info/entry_points.txt,sha256=U6dmxSpKs1Pe9vWiR29VPhJMDjrmZeJCSxvfLGR8BD4,36
21
+ pum-1.1.15.dist-info/top_level.txt,sha256=ddiI4HLBhY6ql-NNm0Ez0JhoOHdWDIzrHeCdHmmagcc,4
22
+ pum-1.1.15.dist-info/RECORD,,
@@ -1,19 +0,0 @@
1
- #TODO comments
2
- upgrades_table: qwat_sys.upgrades
3
- delta_dir: ../update/delta/
4
- backup_file: /tmp/backup.dump
5
- ignore_elements:
6
- - columns
7
- - constraints
8
- - views
9
- - sequences
10
- - indexes
11
- - triggers
12
- - functions
13
- - rules
14
-
15
- # pg_dump_exe = 'C:\\Program Files\\PostgreSQL\\9.3\\bin\\pg_dump.exe'
16
- pg_dump_exe: pg_dump
17
-
18
- # pg_restore_exe = 'C:\\Program Files\\PostgreSQL\\9.3\\bin\\pg_restore.exe'
19
- pg_restore_exe: pg_restore
File without changes