dbhydra 2.2.8__tar.gz → 2.2.9__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 (30) hide show
  1. {dbhydra-2.2.8 → dbhydra-2.2.9}/PKG-INFO +1 -1
  2. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/dbhydra_core.py +2 -2
  3. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/abstract_db.py +1 -0
  4. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/mysql_db.py +1 -1
  5. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/tables.py +10 -1
  6. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/xlsx_db.py +2 -1
  7. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra.egg-info/PKG-INFO +1 -1
  8. {dbhydra-2.2.8 → dbhydra-2.2.9}/setup.py +1 -1
  9. {dbhydra-2.2.8 → dbhydra-2.2.9}/LICENSE +0 -0
  10. {dbhydra-2.2.8 → dbhydra-2.2.9}/README.md +0 -0
  11. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/__init__.py +0 -0
  12. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/__init__.py +0 -0
  13. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/abstract_table.py +0 -0
  14. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/bigquery_db.py +0 -0
  15. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/errors/__init__.py +0 -0
  16. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/errors/exceptions.py +0 -0
  17. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/migrator.py +0 -0
  18. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/mongo_db.py +0 -0
  19. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/postgres_db.py +0 -0
  20. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/src/sqlserver_db.py +0 -0
  21. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/test_migrator.py +0 -0
  22. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/tests/__init__.py +0 -0
  23. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/tests/test_cases.py +0 -0
  24. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/tests/test_mongo.py +0 -0
  25. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra/tests/test_sql.py +0 -0
  26. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra.egg-info/SOURCES.txt +0 -0
  27. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra.egg-info/dependency_links.txt +0 -0
  28. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra.egg-info/requires.txt +0 -0
  29. {dbhydra-2.2.8 → dbhydra-2.2.9}/dbhydra.egg-info/top_level.txt +0 -0
  30. {dbhydra-2.2.8 → dbhydra-2.2.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbhydra
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: Data science friendly ORM combining Python
5
5
  Home-page: https://github.com/DovaX/dbhydra
6
6
  Author: DovaX
@@ -22,8 +22,8 @@ class Jsonable(str):
22
22
  """Is used as type in python_database_type_mapping"""
23
23
  pass
24
24
 
25
- class BLOB(str):
26
- """Store BLOBS up to 16MB."""
25
+ class Blob(str):
26
+ """Store BLOBs up to 16MB."""
27
27
  pass
28
28
 
29
29
 
@@ -58,6 +58,7 @@ class AbstractDb(abc.ABC):
58
58
  'Union': 'object',
59
59
  'Optional': 'object',
60
60
  'Jsonable': 'Jsonable',
61
+ 'Blob': 'Blob',
61
62
  # 'FrozenSet': frozenset,
62
63
  # 'Deque': list,
63
64
  # 'Any': object,
@@ -20,7 +20,7 @@ class MysqlDb(AbstractDb):
20
20
  'bool': "tinyint",
21
21
  'datetime': "datetime",
22
22
  'Jsonable': "json",
23
- 'BLOB': "mediumblob",
23
+ 'Blob': "mediumblob",
24
24
  }
25
25
 
26
26
  def __init__(self, *args, **kwargs):
@@ -5,7 +5,6 @@ import abc
5
5
  import time
6
6
  #xlsx imports
7
7
  import pathlib
8
- import pymysql
9
8
  from dbhydra.src.abstract_table import AbstractTable, AbstractSelectable, AbstractJoinable
10
9
  import binascii
11
10
 
@@ -906,6 +905,11 @@ class XlsxTable(AbstractTable):
906
905
  self.table_directory_path: pathlib.Path = self.db1.db_directory_path / table_filename
907
906
 
908
907
  def _save_table(self, df: pd.DataFrame):
908
+ blob_columns = [
909
+ column for column, type_ in self.column_type_dict.items() if type_ == "Blob"
910
+ ]
911
+ df[blob_columns] = df[blob_columns].map(lambda x: x.hex() if x is not None else None)
912
+
909
913
  if self.db1.is_csv:
910
914
  df.to_csv(self.table_directory_path, index=False)
911
915
  else:
@@ -963,6 +967,9 @@ class XlsxTable(AbstractTable):
963
967
  date_columns = [
964
968
  column for column, type_ in self.column_type_dict.items() if type_ == "datetime"
965
969
  ]
970
+ blob_columns = [
971
+ column for column, type_ in self.column_type_dict.items() if type_ == "Blob"
972
+ ]
966
973
 
967
974
  # BUG: If XlsxTable is being accessed by multiple threads, read operation
968
975
  # might fail due to race conditions. Add retry mechanism to handle these cases.
@@ -977,6 +984,8 @@ class XlsxTable(AbstractTable):
977
984
  else:
978
985
  print(f"Failed to read data from {self.table_directory_path}, returning empty DataFrame")
979
986
  df = pd.DataFrame(columns=self.columns)
987
+
988
+ df[blob_columns] = df[blob_columns].map(lambda x: bytes.fromhex(x) if x else None)
980
989
  return df
981
990
 
982
991
  def _select(self, column_type_map, date_columns):
@@ -41,7 +41,8 @@ class XlsxDb(AbstractDb):
41
41
  'dict': "str",
42
42
  'bool': "bool",
43
43
  'datetime': "datetime",
44
- 'Jsonable': "str"
44
+ 'Jsonable': "str",
45
+ 'Blob': "Blob"
45
46
  }
46
47
 
47
48
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbhydra
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: Data science friendly ORM combining Python
5
5
  Home-page: https://github.com/DovaX/dbhydra
6
6
  Author: DovaX
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name='dbhydra',
8
- version='2.2.8',
8
+ version='2.2.9',
9
9
  author='DovaX',
10
10
  author_email='dovax.ai@gmail.com',
11
11
  description='Data science friendly ORM combining Python',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes