database-postgresql-local 0.1.0__tar.gz → 0.1.2.1234__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 (18) hide show
  1. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/PKG-INFO +2 -3
  2. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/generic_crud_postgresql.py +19 -11
  3. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/utils.py +1 -1
  4. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local.egg-info/PKG-INFO +2 -3
  5. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local.egg-info/requires.txt +1 -2
  6. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/setup.py +4 -3
  7. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/README.md +0 -0
  8. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/__init__.py +0 -0
  9. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/connector.py +0 -0
  10. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/constants_src.py +0 -0
  11. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/cursor.py +0 -0
  12. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/table_columns.py +0 -0
  13. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local/src/table_definition.py +0 -0
  14. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local.egg-info/SOURCES.txt +0 -0
  15. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local.egg-info/dependency_links.txt +0 -0
  16. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/database_postgresql_local.egg-info/top_level.txt +0 -0
  17. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/pyproject.toml +0 -0
  18. {database_postgresql_local-0.1.0 → database_postgresql_local-0.1.2.1234}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database-postgresql-local
3
- Version: 0.1.0
3
+ Version: 0.1.2.1234
4
4
  Summary: PyPI Package for Circles database-postgresql-local Python
5
5
  Home-page: https://github.com/circles-zone/database-postgresql-local-python-package
6
6
  Author: Circles
@@ -8,9 +8,8 @@ Author-email: info@circlez.ai
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Operating System :: OS Independent
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: logger-local
12
- Requires-Dist: database-sql-local
13
11
  Requires-Dist: python-sdk-remote
12
+ Requires-Dist: logger-local
14
13
  Requires-Dist: psycopg2
15
14
  Dynamic: author
16
15
  Dynamic: author-email
@@ -16,7 +16,7 @@ from .cursor import Cursor
16
16
  from .table_definition import table_definition
17
17
  from .utils import (detect_if_is_test_data, generate_id_column_name,
18
18
  generate_table_name, generate_view_name,
19
- get_entity_type_by_table_name, get_where_params,
19
+ get_entity_type_id_by_table_name, get_where_params,
20
20
  process_insert_data_dict, process_update_data_dict,
21
21
  process_upsert_data_dict,
22
22
  replace_view_with_table, validate_none_select_table_name,
@@ -31,7 +31,7 @@ from .utils import (detect_if_is_test_data, generate_id_column_name,
31
31
 
32
32
 
33
33
  class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
34
- object=CRUD_POSTGRESQL_CODE_LOGGER_OBJECT):
34
+ object=CRUD_POSTGRESQL_CODE_LOGGER_OBJECT):
35
35
  """A class that provides generic CRUD functionality for PostgreSQL databases.
36
36
  There are 4 main functions to create, read, update, and delete data from the database.
37
37
  The rest of the functions are helper functions or wrappers around the main functions."""
@@ -51,10 +51,13 @@ class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
51
51
  self.connection = Connector.connect(schema_name=default_schema_name)
52
52
  self._cursor = self.connection.cursor()
53
53
  self.default_table_name = default_table_name or generate_table_name(default_schema_name)
54
- self.default_view_table_name = default_view_table_name or generate_view_name(
55
- self.default_table_name)
56
- self.default_column_name = default_column_name or generate_id_column_name(self.default_table_name)
57
- self.default_view_with_deleted_and_test_data = default_view_with_deleted_and_test_data
54
+ self.default_view_table_name = default_view_table_name \
55
+ or generate_view_name(
56
+ self.default_table_name)
57
+ self.default_column_name = default_column_name \
58
+ or generate_id_column_name(self.default_table_name)
59
+ self.default_view_with_deleted_and_test_data = \
60
+ default_view_with_deleted_and_test_data
58
61
  self.default_select_clause_value = default_select_clause_value
59
62
  self.default_where = default_where
60
63
  self.is_test_data = is_test_data or detect_if_is_test_data()
@@ -75,7 +78,8 @@ class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
75
78
  object={"data_dict": data_dict})
76
79
 
77
80
  data_dict = self.__add_create_updated_user_profile_ids(
78
- data_dict=data_dict, add_created_user_id=True, schema_name=schema_name, table_name=table_name)
81
+ data_dict=data_dict, add_created_user_id=True,
82
+ schema_name=schema_name, table_name=table_name)
79
83
 
80
84
  columns, values, params = process_insert_data_dict(data_dict=data_dict)
81
85
 
@@ -127,8 +131,9 @@ class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
127
131
  def __get_existing_duplicate_id_with_undelete(
128
132
  self, schema_name: str, table_name: str, data_dict: dict) -> int | None:
129
133
  column_name = generate_id_column_name(table_name)
130
- where, params = self.get_constraint_where_clause(schema_name=schema_name, table_name=table_name,
131
- data_dict=data_dict)
134
+ where, params = self.get_constraint_where_clause(
135
+ schema_name=schema_name, table_name=table_name,
136
+ data_dict=data_dict)
132
137
  row = self.select_one_tuple_by_where(
133
138
  schema_name=schema_name, view_table_name=table_name,
134
139
  select_clause_value=f"{column_name}, end_timestamp",
@@ -170,9 +175,11 @@ class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
170
175
  existing_duplicate_id = None
171
176
  else:
172
177
  existing_duplicate_id = self.select_one_value_by_where(
173
- schema_name=schema_name, view_table_name=table_name, select_clause_value=column_name,
178
+ schema_name=schema_name, view_table_name=table_name,
179
+ select_clause_value=column_name,
174
180
  where=where, params=params)
175
181
  return existing_duplicate_id
182
+
176
183
  def update_by_column_and_value(
177
184
  self, *, schema_name: str = None, table_name: str = None,
178
185
  column_name: str = None, column_value: Any,
@@ -257,6 +264,7 @@ class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
257
264
  self.connection.commit()
258
265
  updated_rows = self.cursor.get_affected_row_count()
259
266
  return updated_rows
267
+
260
268
  def update_by_column_and_value(
261
269
  self, *, schema_name: str = None, table_name: str = None,
262
270
  column_name: str = None, column_value: Any,
@@ -851,7 +859,7 @@ class GenericCrudPostgresql(GenericCrudAbstract, metaclass=ABCMetaLogger,
851
859
 
852
860
  def __add_identifier(self, data_dict: dict, table_name: str) -> None:
853
861
  # If there's an "identifier" column in the table, we want to insert a random identifier
854
- identifier_entity_type_id = get_entity_type_by_table_name(table_name)
862
+ identifier_entity_type_id = get_entity_type_id_by_table_name(table_name)
855
863
  if not identifier_entity_type_id:
856
864
  return
857
865
  identifier = NumberGenerator.get_random_identifier(
@@ -82,7 +82,7 @@ def generate_view_name(table_name: str) -> str:
82
82
  return f"{table_name}_view"
83
83
 
84
84
 
85
- def get_entity_type_by_table_name(table_name: str) -> int:
85
+ def get_entity_type_id_by_table_name(table_name: str) -> int:
86
86
  """Gets the entity type ID for a table."""
87
87
  # This would be implemented based on your entity type mapping
88
88
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database-postgresql-local
3
- Version: 0.1.0
3
+ Version: 0.1.2.1234
4
4
  Summary: PyPI Package for Circles database-postgresql-local Python
5
5
  Home-page: https://github.com/circles-zone/database-postgresql-local-python-package
6
6
  Author: Circles
@@ -8,9 +8,8 @@ Author-email: info@circlez.ai
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Operating System :: OS Independent
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: logger-local
12
- Requires-Dist: database-sql-local
13
11
  Requires-Dist: python-sdk-remote
12
+ Requires-Dist: logger-local
14
13
  Requires-Dist: psycopg2
15
14
  Dynamic: author
16
15
  Dynamic: author-email
@@ -1,4 +1,3 @@
1
- logger-local
2
- database-sql-local
3
1
  python-sdk-remote
2
+ logger-local
4
3
  psycopg2
@@ -24,7 +24,7 @@ setuptools.setup(
24
24
  name=PACKAGE_NAME,
25
25
  # Increase this number every time you make a change you
26
26
  # want to publish. After 0.0.9 switch to 0.0.10 and not 0.1.0
27
- version='0.1.0',
27
+ version='0.1.2.1234', # https://pypi.org/project/database-postgresql-local/
28
28
  author="Circles",
29
29
  author_email="info@circlez.ai",
30
30
  description=f"PyPI Package for Circles {PACKAGE_NAME} Python",
@@ -51,12 +51,13 @@ setuptools.setup(
51
51
  ],
52
52
  # TODO: Update which packages to include with this package in production
53
53
  # (dependencies) - Not for development/testing
54
+ # When another package/code imports from this package, the packages
55
+ # in install_requires will be installed automatically
54
56
  install_requires=[
57
+ 'python-sdk-remote',
55
58
  # TODO: in -remote package please use logger-remote instead.
56
59
  'logger-local',
57
60
  # TODO: In -remote package please delete this line.
58
- 'database-sql-local',
59
- 'python-sdk-remote',
60
61
  'psycopg2'
61
62
  ]
62
63
  )