ul-db-utils 5.2.1.dev0__tar.gz → 6.0.0.dev2__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.
Files changed (104) hide show
  1. {ul_db_utils-5.2.1.dev0/ul_db_utils.egg-info → ul_db_utils-6.0.0.dev2}/PKG-INFO +11 -20
  2. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/pyproject.toml +50 -57
  3. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/commands/cmd_docs.py +2 -3
  4. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/waiting_for_postgres.py +2 -2
  5. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2/ul_db_utils.egg-info}/PKG-INFO +11 -20
  6. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils.egg-info/SOURCES.txt +0 -3
  7. ul_db_utils-6.0.0.dev2/ul_db_utils.egg-info/entry_points.txt +2 -0
  8. ul_db_utils-6.0.0.dev2/ul_db_utils.egg-info/requires.txt +11 -0
  9. ul_db_utils-5.2.1.dev0/setup.py +0 -67
  10. ul_db_utils-5.2.1.dev0/ul_db_utils/commands/doc_request_sql.sql +0 -16
  11. ul_db_utils-5.2.1.dev0/ul_db_utils/modules/audit.sql +0 -251
  12. ul_db_utils-5.2.1.dev0/ul_db_utils.egg-info/entry_points.txt +0 -2
  13. ul_db_utils-5.2.1.dev0/ul_db_utils.egg-info/requires.txt +0 -15
  14. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/LICENSE +0 -0
  15. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/README.md +0 -0
  16. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/setup.cfg +0 -0
  17. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/__init__.py +0 -0
  18. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/commands/__init__.py +0 -0
  19. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/commands/cmd_action.py +0 -0
  20. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/commands/cmd_dump.py +0 -0
  21. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/commands/cmd_restore.py +0 -0
  22. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/commands/cmd_waiting.py +0 -0
  23. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/conf.py +0 -0
  24. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/__init__.py +0 -0
  25. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/compare_null_error.py +0 -0
  26. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/db_error.py +0 -0
  27. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/db_filter_error.py +0 -0
  28. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/db_sort_error.py +0 -0
  29. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/deletion_not_allowed.py +0 -0
  30. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/multiple_objects_returned.py +0 -0
  31. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/unknow_field_error.py +0 -0
  32. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/update_column_not_allowed_error.py +0 -0
  33. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/errors/update_not_allowed.py +0 -0
  34. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/main.py +0 -0
  35. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/__init__.py +0 -0
  36. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/api_user.py +0 -0
  37. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_api_user_log_model.py +0 -0
  38. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_document.py +0 -0
  39. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_immutable_model.py +0 -0
  40. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_mater_pg_view.py +0 -0
  41. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_model.py +0 -0
  42. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_undeletable_model.py +0 -0
  43. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_undeletable_user_log_model.py +0 -0
  44. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/base_user_log_model.py +0 -0
  45. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/media_storage/__init__.py +0 -0
  46. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/media_storage/media_file.py +0 -0
  47. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/media_storage/media_file_download_link.py +0 -0
  48. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/media_storage/media_file_type.py +0 -0
  49. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/methods/__init__.py +0 -0
  50. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/methods/make_immutable_column.py +0 -0
  51. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/model/referense_link.py +0 -0
  52. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/__init__.py +0 -0
  53. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/audit_manager.py +0 -0
  54. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/custom_query.py +0 -0
  55. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/db.py +0 -0
  56. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/db_context.py +0 -0
  57. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/mongo_db_modules/__init__.py +0 -0
  58. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/mongo_db_modules/db.py +0 -0
  59. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/mongo_db_modules/db_context.py +0 -0
  60. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/postgres_modules/__init__.py +0 -0
  61. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/postgres_modules/custom_query.py +0 -0
  62. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/postgres_modules/db.py +0 -0
  63. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/postgres_modules/db_context.py +0 -0
  64. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/postgres_modules/transaction_commit.py +0 -0
  65. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/modules/transaction_commit.py +0 -0
  66. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/py.typed +0 -0
  67. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/repository/__init__.py +0 -0
  68. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/repository/abstract_repository.py +0 -0
  69. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/repository/mongoengine_repository.py +0 -0
  70. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/repository/sqlalchemy_repository.py +0 -0
  71. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/search/__init__.py +0 -0
  72. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/search/db_search.py +0 -0
  73. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/search/doc_db_search.py +0 -0
  74. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/search/helpers.py +0 -0
  75. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/__init__.py +0 -0
  76. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/camel_to_snake.py +0 -0
  77. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/__init__.py +0 -0
  78. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_bool.py +0 -0
  79. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_choices.py +0 -0
  80. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_dict_keys.py +0 -0
  81. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_dict_keys_choice.py +0 -0
  82. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_dict_keys_strict.py +0 -0
  83. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_dict_str_keys.py +0 -0
  84. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_dict_upper_keys.py +0 -0
  85. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_float.py +0 -0
  86. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_int.py +0 -0
  87. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_int_positive.py +0 -0
  88. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_len.py +0 -0
  89. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_list.py +0 -0
  90. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_list_of.py +0 -0
  91. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_positive_int_non_zero.py +0 -0
  92. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_set.py +0 -0
  93. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_str.py +0 -0
  94. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_type.py +0 -0
  95. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure/ensure_url_with_scheme_and_netloc.py +0 -0
  96. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/ensure_db_object_exists.py +0 -0
  97. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/filter_conversion_doc_db.py +0 -0
  98. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/get_model_template.py +0 -0
  99. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/query_soft_delete.py +0 -0
  100. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/remove_duplicated_spaces_of_string.py +0 -0
  101. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/types.py +0 -0
  102. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils/utils/waiting_for_mongo.py +0 -0
  103. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils.egg-info/dependency_links.txt +0 -0
  104. {ul_db_utils-5.2.1.dev0 → ul_db_utils-6.0.0.dev2}/ul_db_utils.egg-info/top_level.txt +0 -0
@@ -1,12 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ul-db-utils
3
- Version: 5.2.1.dev0
3
+ Version: 6.0.0.dev2
4
4
  Summary: UL db utils Python package
5
- Home-page: https://gitlab.neroelectronics.by/unic-lab/libraries/common-python-utils/db-utils.git
6
5
  Author: Unic-lab
7
- Author-email:
8
6
  License: MIT
9
- Platform: any
10
7
  Classifier: Intended Audience :: Developers
11
8
  Classifier: License :: OSI Approved :: MIT License
12
9
  Classifier: Programming Language :: Python
@@ -15,24 +12,18 @@ Classifier: Operating System :: OS Independent
15
12
  Requires-Python: >=3.14
16
13
  Description-Content-Type: text/markdown
17
14
  License-File: LICENSE
18
- Requires-Dist: Flask==3.1.0
19
- Requires-Dist: py-dateutil==2.2
20
- Requires-Dist: psycopg2-binary>=2.9.11
21
- Requires-Dist: psycogreen==1.0.2
22
- Requires-Dist: Flask-SQLAlchemy==3.1.1
23
- Requires-Dist: Flask-Migrate==4.1.0
24
- Requires-Dist: SQLAlchemy[mypy]==2.0.29
25
- Requires-Dist: SQLAlchemy-Utils==0.41.2
15
+ Requires-Dist: Flask>=3.1.3
16
+ Requires-Dist: py-dateutil>=2.2
17
+ Requires-Dist: Flask-SQLAlchemy>=3.1.1
18
+ Requires-Dist: Flask-Migrate>=4.1.0
19
+ Requires-Dist: SQLAlchemy[mypy]>=2.0.48
26
20
  Requires-Dist: sqlalchemy-serializer>=1.6.2
27
- Requires-Dist: alembic==1.14.1
28
- Requires-Dist: flask-mongoengine-3==1.1.0
29
- Requires-Dist: redis==5.2.1
30
- Requires-Dist: types-psycopg2>=2.9.21.20260223
31
- Requires-Dist: types-sqlalchemy-utils==1.1.0
32
- Requires-Dist: ul-py-tool==3.0.2.dev1
33
- Dynamic: home-page
21
+ Requires-Dist: alembic>=1.18.4
22
+ Requires-Dist: flask-mongoengine-3>=1.1.0
23
+ Requires-Dist: redis>=7.4.0
24
+ Requires-Dist: ul-py-tool>=3.0.2.dev1
25
+ Requires-Dist: psycopg[binary]>=3.3.3
34
26
  Dynamic: license-file
35
- Dynamic: platform
36
27
 
37
28
  # Generic library db-utils
38
29
 
@@ -1,57 +1,50 @@
1
- [project]
2
- name = "ul-db-utils"
3
- version = "5.2.1-dev"
4
- description = "UL db utils Python package"
5
- requires-python = ">=3.14"
6
- readme = "README.md"
7
- license = { text = "MIT" }
8
- authors = [{ name = "Unic-lab" }]
9
- classifiers = [
10
- "Intended Audience :: Developers",
11
- "License :: OSI Approved :: MIT License",
12
- "Programming Language :: Python",
13
- "Programming Language :: Python :: 3.14",
14
- "Operating System :: OS Independent",
15
- ]
16
- dependencies = [
17
- "Flask ==3.1.0",
18
- "py-dateutil ==2.2",
19
- "psycopg2-binary >=2.9.11",
20
- "psycogreen ==1.0.2",
21
- "Flask-SQLAlchemy ==3.1.1",
22
- "Flask-Migrate ==4.1.0",
23
- "SQLAlchemy[mypy] ==2.0.29",
24
- "SQLAlchemy-Utils ==0.41.2",
25
- "sqlalchemy-serializer >=1.6.2",
26
- "alembic ==1.14.1",
27
- "flask-mongoengine-3 ==1.1.0",
28
-
29
- "redis ==5.2.1", # 4.1.4 bu latests is 4.3.4 = because NO correct changelogs in repo
30
-
31
- "types-psycopg2 >=2.9.21.20260223",
32
- "types-sqlalchemy-utils ==1.1.0",
33
-
34
- "ul-py-tool ==3.0.2.dev1"
35
- ]
36
-
37
- [build-system]
38
- requires = ["setuptools"]
39
- build-backend = "setuptools.build_meta"
40
-
41
- [dev-packages]
42
-
43
- [project.scripts]
44
- db-utils = "ul_db_utils.main:main"
45
-
46
- [tool.uvs.scripts]
47
- prepare = "uv build"
48
- lint = "ulpytool lint --exclude-import flask"
49
- test = "ulpytool test"
50
- version_minor = "ulpytool minor"
51
- version_major = "ulpytool major"
52
- version_patch = "ulpytool patch"
53
-
54
- [[source]]
55
- url = "https://pypi.org/simple"
56
- verify_ssl = true
57
- name = "pypi"
1
+ [project]
2
+ name = "ul-db-utils"
3
+ version = "6.0.0.dev.2"
4
+ description = "UL db utils Python package"
5
+ requires-python = ">=3.14"
6
+ readme = "README.md"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Unic-lab" }]
9
+ classifiers = [
10
+ "Intended Audience :: Developers",
11
+ "License :: OSI Approved :: MIT License",
12
+ "Programming Language :: Python",
13
+ "Programming Language :: Python :: 3.14",
14
+ "Operating System :: OS Independent",
15
+ ]
16
+ dependencies = [
17
+ "Flask >=3.1.3",
18
+ "py-dateutil >=2.2",
19
+ "Flask-SQLAlchemy >=3.1.1",
20
+ "Flask-Migrate >=4.1.0",
21
+ "SQLAlchemy[mypy] >=2.0.48",
22
+ "sqlalchemy-serializer >=1.6.2",
23
+ "alembic >=1.18.4",
24
+ "flask-mongoengine-3 >=1.1.0",
25
+ "redis >=7.4.0",
26
+ "ul-py-tool >=3.0.2.dev1",
27
+ "psycopg[binary] >=3.3.3",
28
+ ]
29
+
30
+ [build-system]
31
+ requires = ["setuptools"]
32
+ build-backend = "setuptools.build_meta"
33
+
34
+ [dev-packages]
35
+
36
+ [project.scripts]
37
+ uldbutls = "ul_db_utils.main:main"
38
+
39
+ [tool.uvs.scripts]
40
+ prepare = "uv build"
41
+ lint = "ulpytool lint --exclude-import flask"
42
+ test = "ulpytool test"
43
+ version_minor = "ulpytool minor"
44
+ version_major = "ulpytool major"
45
+ version_patch = "ulpytool patch"
46
+
47
+ [[source]]
48
+ url = "https://pypi.org/simple"
49
+ verify_ssl = true
50
+ name = "pypi"
@@ -1,11 +1,10 @@
1
1
  import argparse
2
2
  import os
3
3
  import re
4
- from contextlib import closing
5
4
  from typing import Any
6
5
  from urllib.parse import urlparse
7
6
 
8
- import psycopg2
7
+ import psycopg
9
8
  from pydantic import PostgresDsn
10
9
  from sqlalchemy import text
11
10
  from ul_py_tool.commands.cmd import Cmd
@@ -35,7 +34,7 @@ class CmdDocs(Cmd):
35
34
  schema_db=self.schema_db,
36
35
  ))
37
36
 
38
- with closing(psycopg2.connect(self.uri.unicode_string())) as conn:
37
+ with psycopg.connect(self.uri.unicode_string()) as conn:
39
38
  with conn.cursor() as cursor:
40
39
  cursor.execute(str(doc_request_sql))
41
40
  doc_data = cursor.fetchall()
@@ -2,7 +2,7 @@ import logging
2
2
  import time
3
3
  from urllib.parse import urlparse
4
4
 
5
- from sqlalchemy_utils.types.pg_composite import psycopg2
5
+ import psycopg
6
6
 
7
7
  logger = logging.getLogger(__name__)
8
8
 
@@ -12,7 +12,7 @@ def waiting_for_postgres(uri: str, *, retry_max_count: int = 100, retry_delay_s:
12
12
 
13
13
  for i in range(0, retry_max_count):
14
14
  try:
15
- with psycopg2.connect(
15
+ with psycopg.connect(
16
16
  dbname=parsed_db_uri.path.strip('/'),
17
17
  user=parsed_db_uri.username,
18
18
  password=parsed_db_uri.password,
@@ -1,12 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ul-db-utils
3
- Version: 5.2.1.dev0
3
+ Version: 6.0.0.dev2
4
4
  Summary: UL db utils Python package
5
- Home-page: https://gitlab.neroelectronics.by/unic-lab/libraries/common-python-utils/db-utils.git
6
5
  Author: Unic-lab
7
- Author-email:
8
6
  License: MIT
9
- Platform: any
10
7
  Classifier: Intended Audience :: Developers
11
8
  Classifier: License :: OSI Approved :: MIT License
12
9
  Classifier: Programming Language :: Python
@@ -15,24 +12,18 @@ Classifier: Operating System :: OS Independent
15
12
  Requires-Python: >=3.14
16
13
  Description-Content-Type: text/markdown
17
14
  License-File: LICENSE
18
- Requires-Dist: Flask==3.1.0
19
- Requires-Dist: py-dateutil==2.2
20
- Requires-Dist: psycopg2-binary>=2.9.11
21
- Requires-Dist: psycogreen==1.0.2
22
- Requires-Dist: Flask-SQLAlchemy==3.1.1
23
- Requires-Dist: Flask-Migrate==4.1.0
24
- Requires-Dist: SQLAlchemy[mypy]==2.0.29
25
- Requires-Dist: SQLAlchemy-Utils==0.41.2
15
+ Requires-Dist: Flask>=3.1.3
16
+ Requires-Dist: py-dateutil>=2.2
17
+ Requires-Dist: Flask-SQLAlchemy>=3.1.1
18
+ Requires-Dist: Flask-Migrate>=4.1.0
19
+ Requires-Dist: SQLAlchemy[mypy]>=2.0.48
26
20
  Requires-Dist: sqlalchemy-serializer>=1.6.2
27
- Requires-Dist: alembic==1.14.1
28
- Requires-Dist: flask-mongoengine-3==1.1.0
29
- Requires-Dist: redis==5.2.1
30
- Requires-Dist: types-psycopg2>=2.9.21.20260223
31
- Requires-Dist: types-sqlalchemy-utils==1.1.0
32
- Requires-Dist: ul-py-tool==3.0.2.dev1
33
- Dynamic: home-page
21
+ Requires-Dist: alembic>=1.18.4
22
+ Requires-Dist: flask-mongoengine-3>=1.1.0
23
+ Requires-Dist: redis>=7.4.0
24
+ Requires-Dist: ul-py-tool>=3.0.2.dev1
25
+ Requires-Dist: psycopg[binary]>=3.3.3
34
26
  Dynamic: license-file
35
- Dynamic: platform
36
27
 
37
28
  # Generic library db-utils
38
29
 
@@ -1,7 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- setup.py
5
4
  ul_db_utils/__init__.py
6
5
  ul_db_utils/conf.py
7
6
  ul_db_utils/main.py
@@ -18,7 +17,6 @@ ul_db_utils/commands/cmd_docs.py
18
17
  ul_db_utils/commands/cmd_dump.py
19
18
  ul_db_utils/commands/cmd_restore.py
20
19
  ul_db_utils/commands/cmd_waiting.py
21
- ul_db_utils/commands/doc_request_sql.sql
22
20
  ul_db_utils/errors/__init__.py
23
21
  ul_db_utils/errors/compare_null_error.py
24
22
  ul_db_utils/errors/db_error.py
@@ -47,7 +45,6 @@ ul_db_utils/model/media_storage/media_file_type.py
47
45
  ul_db_utils/model/methods/__init__.py
48
46
  ul_db_utils/model/methods/make_immutable_column.py
49
47
  ul_db_utils/modules/__init__.py
50
- ul_db_utils/modules/audit.sql
51
48
  ul_db_utils/modules/audit_manager.py
52
49
  ul_db_utils/modules/custom_query.py
53
50
  ul_db_utils/modules/db.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ uldbutls = ul_db_utils.main:main
@@ -0,0 +1,11 @@
1
+ Flask>=3.1.3
2
+ py-dateutil>=2.2
3
+ Flask-SQLAlchemy>=3.1.1
4
+ Flask-Migrate>=4.1.0
5
+ SQLAlchemy[mypy]>=2.0.48
6
+ sqlalchemy-serializer>=1.6.2
7
+ alembic>=1.18.4
8
+ flask-mongoengine-3>=1.1.0
9
+ redis>=7.4.0
10
+ ul-py-tool>=3.0.2.dev1
11
+ psycopg[binary]>=3.3.3
@@ -1,67 +0,0 @@
1
- from os import path
2
- from setuptools import setup, find_packages
3
-
4
- HERE = path.abspath(path.dirname(__file__))
5
-
6
- with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
7
- long_description = f.read()
8
-
9
-
10
- setup(
11
- name='ul-db-utils',
12
- version='5.2.0',
13
- description='Python ul db utils',
14
- author='Unic-lab',
15
- author_email='',
16
- url='https://gitlab.neroelectronics.by/unic-lab/libraries/common-python-utils/db-utils.git',
17
- packages=find_packages(include=['ul_db_utils*']),
18
- platforms='any',
19
- package_data={
20
- '': ['*.sql'],
21
- 'ul_db_utils': ['py.typed'],
22
- },
23
- long_description=long_description,
24
- long_description_content_type="text/markdown",
25
- classifiers=[
26
- "Intended Audience :: Developers",
27
- "License :: OSI Approved :: MIT License",
28
- "Programming Language :: Python",
29
- "Programming Language :: Python :: 3.6",
30
- "Programming Language :: Python :: 3.7",
31
- "Programming Language :: Python :: 3.8",
32
- "Programming Language :: Python :: 3.9",
33
- "Programming Language :: Python :: 3.10",
34
- "Programming Language :: Python :: 3.11",
35
- "Programming Language :: Python :: 3.12",
36
- "Programming Language :: Python :: 3.13",
37
- "Programming Language :: Python :: 3.14",
38
- "Operating System :: OS Independent",
39
- ],
40
- entry_points={
41
- "console_scripts": [
42
- 'uldbutls=ul_db_utils.main:main',
43
- ],
44
- },
45
- include_package_data=True,
46
- install_requires=[
47
- "flask==3.1.0", # FOR COMPATIBILITY
48
- "py-dateutil==2.2",
49
-
50
- "psycopg2-binary==2.9.9",
51
- "psycogreen==1.0.2",
52
- "flask-sqlalchemy==3.1.1",
53
- "flask-migrate==4.1.0",
54
- "sqlalchemy[mypy]==2.0.29",
55
- "sqlalchemy-utils==0.41.2",
56
- "sqlalchemy-serializer==1.4.21",
57
- "alembic==1.14.1",
58
- "flask-mongoengine-3==1.1.0",
59
-
60
- "redis==5.2.1",
61
-
62
- "types-psycopg2==2.9.21.20250121",
63
- "types-sqlalchemy-utils==1.1.0",
64
-
65
- "ul-py-tool>=3.0.0",
66
- ],
67
- )
@@ -1,16 +0,0 @@
1
- SELECT
2
- current_database() as "db_name",
3
- pgns.nspname as "schema_name",
4
- tbl.relname as "table_name",
5
- obj_description(tbl.oid, 'pg_class') as "table_description",
6
- ARRAY_AGG(pgattr.attname) as "table_field_name",
7
- ARRAY_AGG(pgtype.typname) as "table_field_type",
8
- ARRAY_AGG(col_description(tbl.oid, pgattr.attnum)) as "table_field_description"
9
- FROM pg_class tbl
10
- LEFT OUTER JOIN pg_catalog.pg_namespace pgns ON pgns.nspname = '{schema_db}'
11
- LEFT OUTER JOIN pg_attribute pgattr ON pgattr.attrelid = tbl.oid AND pgattr.attnum > 0 AND pgattr.atttypid != 0
12
- LEFT OUTER JOIN pg_type pgtype ON pgtype.oid = pgattr.atttypid
13
- WHERE tbl.relnamespace = pgns.oid AND tbl.reltype != 0
14
- GROUP BY
15
- db_name, schema_name, table_name, table_description
16
- ORDER BY table_name;
@@ -1,251 +0,0 @@
1
- -- An audit history is important on most tables. Provide an audit trigger that logs to
2
- -- a dedicated audit table for the major relations.
3
- --
4
- -- This file should be generic and not depend on application roles or structures,
5
- -- as it's being listed here:
6
- --
7
- -- https://wiki.postgresql.org/wiki/Audit_trigger_91plus
8
- --
9
- -- This trigger was originally based on
10
- -- http://wiki.postgresql.org/wiki/Audit_trigger
11
- -- but has been completely rewritten.
12
- --
13
- -- Should really be converted into a relocatable EXTENSION, with control and upgrade files.
14
-
15
- CREATE EXTENSION IF NOT EXISTS hstore;
16
- CREATE SCHEMA IF NOT EXISTS audit;
17
- REVOKE ALL ON SCHEMA audit FROM public;
18
-
19
- COMMENT ON SCHEMA audit IS 'Out-of-table audit/history logging tables and trigger functions';
20
-
21
- --
22
- -- Audited data. Lots of information is available, it's just a matter of how much
23
- -- you really want to record. See:
24
- --
25
- -- http://www.postgresql.org/docs/9.1/static/functions-info.html
26
- --
27
- -- Remember, every column you add takes up more audit table space and slows audit
28
- -- inserts.
29
- --
30
- -- Every index you add has a big impact too, so avoid adding indexes to the
31
- -- audit table unless you REALLY need them. The hstore GIST indexes are
32
- -- particularly expensive.
33
- --
34
- -- It is sometimes worth copying the audit table, or a coarse subset of it that
35
- -- you're interested in, into a temporary table where you CREATE any useful
36
- -- indexes and do your analysis.
37
- --
38
- CREATE TABLE IF NOT EXISTS audit.logged_actions (
39
- event_id bigserial primary key,
40
- schema_name text not null,
41
- table_name text not null,
42
- relid oid not null,
43
- session_user_name text,
44
- action_tstamp_tx TIMESTAMP WITH TIME ZONE NOT NULL,
45
- action_tstamp_stm TIMESTAMP WITH TIME ZONE NOT NULL,
46
- action_tstamp_clk TIMESTAMP WITH TIME ZONE NOT NULL,
47
- transaction_id bigint,
48
- application_name text,
49
- client_addr inet,
50
- client_port integer,
51
- client_query text,
52
- action TEXT NOT NULL CHECK (action IN ('I','D','U', 'T')),
53
- row_data hstore,
54
- changed_fields hstore,
55
- statement_only boolean not null
56
- );
57
-
58
- REVOKE ALL ON audit.logged_actions FROM public;
59
-
60
- COMMENT ON TABLE audit.logged_actions IS 'History of auditable actions on audited tables, from audit.if_modified_func()';
61
- COMMENT ON COLUMN audit.logged_actions.event_id IS 'Unique identifier for each auditable event';
62
- COMMENT ON COLUMN audit.logged_actions.schema_name IS 'Database schema audited table for this event is in';
63
- COMMENT ON COLUMN audit.logged_actions.table_name IS 'Non-schema-qualified table name of table event occured in';
64
- COMMENT ON COLUMN audit.logged_actions.relid IS 'Table OID. Changes with drop/create. Get with ''tablename''::regclass';
65
- COMMENT ON COLUMN audit.logged_actions.session_user_name IS 'Login / session user whose statement caused the audited event';
66
- COMMENT ON COLUMN audit.logged_actions.action_tstamp_tx IS 'Transaction start timestamp for tx in which audited event occurred';
67
- COMMENT ON COLUMN audit.logged_actions.action_tstamp_stm IS 'Statement start timestamp for tx in which audited event occurred';
68
- COMMENT ON COLUMN audit.logged_actions.action_tstamp_clk IS 'Wall clock time at which audited event''s trigger call occurred';
69
- COMMENT ON COLUMN audit.logged_actions.transaction_id IS 'Identifier of transaction that made the change. May wrap, but unique paired with action_tstamp_tx.';
70
- COMMENT ON COLUMN audit.logged_actions.client_addr IS 'IP address of client that issued query. Null for unix domain socket.';
71
- COMMENT ON COLUMN audit.logged_actions.client_port IS 'Remote peer IP port address of client that issued query. Undefined for unix socket.';
72
- COMMENT ON COLUMN audit.logged_actions.client_query IS 'Top-level query that caused this auditable event. May be more than one statement.';
73
- COMMENT ON COLUMN audit.logged_actions.application_name IS 'Application name set when this audit event occurred. Can be changed in-session by client.';
74
- COMMENT ON COLUMN audit.logged_actions.action IS 'Action type; I = insert, D = delete, U = update, T = truncate';
75
- COMMENT ON COLUMN audit.logged_actions.row_data IS 'Record value. Null for statement-level trigger. For INSERT this is the new tuple. For DELETE and UPDATE it is the old tuple.';
76
- COMMENT ON COLUMN audit.logged_actions.changed_fields IS 'New values of fields changed by UPDATE. Null except for row-level UPDATE events.';
77
- COMMENT ON COLUMN audit.logged_actions.statement_only IS '''t'' if audit event is from an FOR EACH STATEMENT trigger, ''f'' for FOR EACH ROW';
78
-
79
- CREATE INDEX IF NOT EXISTS logged_actions_relid_idx ON audit.logged_actions(relid);
80
- CREATE INDEX IF NOT EXISTS logged_actions_action_tstamp_tx_stm_idx ON audit.logged_actions(action_tstamp_stm);
81
- CREATE INDEX IF NOT EXISTS logged_actions_action_idx ON audit.logged_actions(action);
82
-
83
- CREATE OR REPLACE FUNCTION audit.if_modified_func() RETURNS TRIGGER AS $body$
84
- DECLARE
85
- audit_row audit.logged_actions;
86
- include_values boolean;
87
- log_diffs boolean;
88
- h_old hstore;
89
- h_new hstore;
90
- excluded_cols text[] = ARRAY[]::text[];
91
- BEGIN
92
- IF TG_WHEN <> 'AFTER' THEN
93
- RAISE EXCEPTION 'audit.if_modified_func() may only run as an AFTER trigger';
94
- END IF;
95
-
96
- audit_row = ROW(
97
- nextval('audit.logged_actions_event_id_seq'), -- event_id
98
- TG_TABLE_SCHEMA::text, -- schema_name
99
- TG_TABLE_NAME::text, -- table_name
100
- TG_RELID, -- relation OID for much quicker searches
101
- session_user::text, -- session_user_name
102
- current_timestamp, -- action_tstamp_tx
103
- statement_timestamp(), -- action_tstamp_stm
104
- clock_timestamp(), -- action_tstamp_clk
105
- txid_current(), -- transaction ID
106
- current_setting('application_name'), -- client application
107
- inet_client_addr(), -- client_addr
108
- inet_client_port(), -- client_port
109
- current_query(), -- top-level query or queries (if multistatement) from client
110
- substring(TG_OP,1,1), -- action
111
- NULL, NULL, -- row_data, changed_fields
112
- 'f' -- statement_only
113
- );
114
-
115
- IF NOT TG_ARGV[0]::boolean IS DISTINCT FROM 'f'::boolean THEN
116
- audit_row.client_query = NULL;
117
- END IF;
118
-
119
- IF TG_ARGV[1] IS NOT NULL THEN
120
- excluded_cols = TG_ARGV[1]::text[];
121
- END IF;
122
-
123
- IF (TG_OP = 'UPDATE' AND TG_LEVEL = 'ROW') THEN
124
- audit_row.row_data = hstore(OLD.*) - excluded_cols;
125
- audit_row.changed_fields = (hstore(NEW.*) - audit_row.row_data) - excluded_cols;
126
- IF audit_row.changed_fields = hstore('') THEN
127
- -- All changed fields are ignored. Skip this update.
128
- RETURN NULL;
129
- END IF;
130
- ELSIF (TG_OP = 'DELETE' AND TG_LEVEL = 'ROW') THEN
131
- audit_row.row_data = hstore(OLD.*) - excluded_cols;
132
- ELSIF (TG_OP = 'INSERT' AND TG_LEVEL = 'ROW') THEN
133
- audit_row.row_data = hstore(NEW.*) - excluded_cols;
134
- ELSIF (TG_LEVEL = 'STATEMENT' AND TG_OP IN ('INSERT','UPDATE','DELETE','TRUNCATE')) THEN
135
- audit_row.statement_only = 't';
136
- ELSE
137
- RAISE EXCEPTION '[audit.if_modified_func] - Trigger func added as trigger for unhandled case: %, %',TG_OP, TG_LEVEL;
138
- RETURN NULL;
139
- END IF;
140
- INSERT INTO audit.logged_actions VALUES (audit_row.*);
141
- RETURN NULL;
142
- END;
143
- $body$
144
- LANGUAGE plpgsql
145
- SECURITY DEFINER
146
- SET search_path = pg_catalog, public;
147
-
148
-
149
- COMMENT ON FUNCTION audit.if_modified_func() IS $body$
150
- Track changes to a table at the statement and/or row level.
151
-
152
- Optional parameters to trigger in CREATE TRIGGER call:
153
-
154
- param 0: boolean, whether to log the query text. Default 't'.
155
-
156
- param 1: text[], columns to ignore in updates. Default [].
157
-
158
- Updates to ignored cols are omitted from changed_fields.
159
-
160
- Updates with only ignored cols changed are not inserted
161
- into the audit log.
162
-
163
- Almost all the processing work is still done for updates
164
- that ignored. If you need to save the load, you need to use
165
- WHEN clause on the trigger instead.
166
-
167
- No warning or error is issued if ignored_cols contains columns
168
- that do not exist in the target table. This lets you specify
169
- a standard set of ignored columns.
170
-
171
- There is no parameter to disable logging of values. Add this trigger as
172
- a 'FOR EACH STATEMENT' rather than 'FOR EACH ROW' trigger if you do not
173
- want to log row values.
174
-
175
- Note that the user name logged is the login role for the session. The audit trigger
176
- cannot obtain the active role because it is reset by the SECURITY DEFINER invocation
177
- of the audit trigger its self.
178
- $body$;
179
-
180
-
181
-
182
- CREATE OR REPLACE FUNCTION audit.audit_table(target_table regclass, audit_rows boolean, audit_query_text boolean, ignored_cols text[]) RETURNS void AS $body$
183
- DECLARE
184
- stm_targets text = 'INSERT OR UPDATE OR DELETE OR TRUNCATE';
185
- _q_txt text;
186
- _ignored_cols_snip text = '';
187
- BEGIN
188
- EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_row ON ' || target_table;
189
- EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_stm ON ' || target_table;
190
-
191
- IF audit_rows THEN
192
- IF array_length(ignored_cols,1) > 0 THEN
193
- _ignored_cols_snip = ', ' || quote_literal(ignored_cols);
194
- END IF;
195
- _q_txt = 'CREATE TRIGGER audit_trigger_row AFTER INSERT OR UPDATE OR DELETE ON ' ||
196
- target_table ||
197
- ' FOR EACH ROW EXECUTE PROCEDURE audit.if_modified_func(' ||
198
- quote_literal(audit_query_text) || _ignored_cols_snip || ');';
199
- RAISE NOTICE '%',_q_txt;
200
- EXECUTE _q_txt;
201
- stm_targets = 'TRUNCATE';
202
- ELSE
203
- END IF;
204
-
205
- _q_txt = 'CREATE TRIGGER audit_trigger_stm AFTER ' || stm_targets || ' ON ' ||
206
- target_table ||
207
- ' FOR EACH STATEMENT EXECUTE PROCEDURE audit.if_modified_func('||
208
- quote_literal(audit_query_text) || ');';
209
- RAISE NOTICE '%',_q_txt;
210
- EXECUTE _q_txt;
211
-
212
- END;
213
- $body$
214
- language 'plpgsql';
215
-
216
- COMMENT ON FUNCTION audit.audit_table(regclass, boolean, boolean, text[]) IS $body$
217
- Add auditing support to a table.
218
-
219
- Arguments:
220
- target_table: Table name, schema qualified if not on search_path
221
- audit_rows: Record each row change, or only audit at a statement level
222
- audit_query_text: Record the text of the client query that triggered the audit event?
223
- ignored_cols: Columns to exclude from update diffs, ignore updates that change only ignored cols.
224
- $body$;
225
-
226
- -- Pg doesn't allow variadic calls with 0 params, so provide a wrapper
227
- CREATE OR REPLACE FUNCTION audit.audit_table(target_table regclass, audit_rows boolean, audit_query_text boolean) RETURNS void AS $body$
228
- SELECT audit.audit_table($1, $2, $3, ARRAY[]::text[]);
229
- $body$ LANGUAGE SQL;
230
-
231
- -- And provide a convenience call wrapper for the simplest case
232
- -- of row-level logging with no excluded cols and query logging enabled.
233
- --
234
- CREATE OR REPLACE FUNCTION audit.audit_table(target_table regclass) RETURNS void AS $body$
235
- SELECT audit.audit_table($1, BOOLEAN 't', BOOLEAN 'f');
236
- $body$ LANGUAGE 'sql';
237
-
238
- COMMENT ON FUNCTION audit.audit_table(regclass) IS $body$
239
- Add auditing support to the given table. Row-level changes will be logged with full client query text. No cols are ignored.
240
- $body$;
241
-
242
- CREATE OR REPLACE VIEW audit.tableslist AS
243
- SELECT DISTINCT triggers.trigger_schema AS schema,
244
- triggers.event_object_table AS auditedtable
245
- FROM information_schema.triggers
246
- WHERE triggers.trigger_name::text IN ('audit_trigger_row'::text, 'audit_trigger_stm'::text)
247
- ORDER BY schema, auditedtable;
248
-
249
- COMMENT ON VIEW audit.tableslist IS $body$
250
- View showing all tables with auditing set up. Ordered by schema, then table.
251
- $body$;
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- db-utils = ul_db_utils.main:main
@@ -1,15 +0,0 @@
1
- Flask==3.1.0
2
- py-dateutil==2.2
3
- psycopg2-binary>=2.9.11
4
- psycogreen==1.0.2
5
- Flask-SQLAlchemy==3.1.1
6
- Flask-Migrate==4.1.0
7
- SQLAlchemy[mypy]==2.0.29
8
- SQLAlchemy-Utils==0.41.2
9
- sqlalchemy-serializer>=1.6.2
10
- alembic==1.14.1
11
- flask-mongoengine-3==1.1.0
12
- redis==5.2.1
13
- types-psycopg2>=2.9.21.20260223
14
- types-sqlalchemy-utils==1.1.0
15
- ul-py-tool==3.0.2.dev1