dbhydra 2.0.12__tar.gz → 2.0.13__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 (29) hide show
  1. {dbhydra-2.0.12 → dbhydra-2.0.13}/PKG-INFO +1 -1
  2. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/mysql_db.py +2 -2
  3. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/tables.py +4 -3
  4. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/xlsx_db.py +7 -5
  5. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra.egg-info/PKG-INFO +1 -1
  6. {dbhydra-2.0.12 → dbhydra-2.0.13}/setup.py +1 -1
  7. {dbhydra-2.0.12 → dbhydra-2.0.13}/LICENSE +0 -0
  8. {dbhydra-2.0.12 → dbhydra-2.0.13}/README.md +0 -0
  9. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/__init__.py +0 -0
  10. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/dbhydra_core.py +0 -0
  11. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/__init__.py +0 -0
  12. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/abstract_db.py +0 -0
  13. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/abstract_table.py +0 -0
  14. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/bigquery_db.py +0 -0
  15. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/errors/__init__.py +0 -0
  16. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/errors/exceptions.py +0 -0
  17. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/migrator.py +0 -0
  18. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/mongo_db.py +0 -0
  19. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/postgres_db.py +0 -0
  20. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/src/sqlserver_db.py +0 -0
  21. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/tests/__init__.py +0 -0
  22. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/tests/test_cases.py +0 -0
  23. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/tests/test_mongo.py +0 -0
  24. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra/tests/test_sql.py +0 -0
  25. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra.egg-info/SOURCES.txt +0 -0
  26. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra.egg-info/dependency_links.txt +0 -0
  27. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra.egg-info/requires.txt +0 -0
  28. {dbhydra-2.0.12 → dbhydra-2.0.13}/dbhydra.egg-info/top_level.txt +0 -0
  29. {dbhydra-2.0.12 → dbhydra-2.0.13}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbhydra
3
- Version: 2.0.12
3
+ Version: 2.0.13
4
4
  Summary: Data science friendly ORM combining Python
5
5
  Home-page: https://github.com/DovaX/dbhydra
6
6
  Author: DovaX
@@ -57,11 +57,11 @@ class MysqlDb(AbstractDb):
57
57
  tables = [x[0] for x in rows]
58
58
  return (tables)
59
59
 
60
- def generate_table_dict(self):
60
+ def generate_table_dict(self, id_column_name = "id"):
61
61
  tables = self.get_all_tables()
62
62
  table_dict = dict()
63
63
  for i, table in enumerate(tables):
64
- table_dict[table] = MysqlTable.init_all_columns(self, table)
64
+ table_dict[table] = MysqlTable.init_all_columns(self, table, id_column_name)
65
65
  return (table_dict)
66
66
 
67
67
 
@@ -905,9 +905,10 @@ class XlsxTable(AbstractTable):
905
905
  return(clean_types)
906
906
 
907
907
 
908
+
908
909
  @classmethod
909
- def init_all_columns(cls, db1, name):
910
- temporary_table = cls(db1, name)
910
+ def init_all_columns(cls, db1, name, id_column_name="id"):
911
+ temporary_table = cls(db1, name, id_column_name)
911
912
  columns = temporary_table.get_all_columns()
912
913
  types = temporary_table.get_all_types()
913
914
 
@@ -918,7 +919,7 @@ class XlsxTable(AbstractTable):
918
919
  types.pop(id_col_index)
919
920
  types.insert(0, "int")
920
921
 
921
- return (cls(db1, name, columns, types))
922
+ return (cls(db1, name, columns, types, id_column_name=id_column_name))
922
923
 
923
924
 
924
925
 
@@ -1,6 +1,7 @@
1
1
  from dbhydra.src.abstract_db import AbstractDb
2
2
  from dbhydra.src.tables import XlsxTable
3
3
 
4
+ import contextlib
4
5
  import threading
5
6
  import pathlib
6
7
  import os
@@ -83,9 +84,10 @@ class XlsxDb(AbstractDb):
83
84
  print("Database directory created")
84
85
  except FileExistsError:
85
86
  print("Database directory already exists")
86
-
87
-
88
-
87
+
88
+ @contextlib.contextmanager
89
+ def transaction(self):
90
+ yield None
89
91
 
90
92
  def get_all_tables(self):
91
93
  root,dirs,files=next(os.walk(self.db_directory_path))
@@ -93,11 +95,11 @@ class XlsxDb(AbstractDb):
93
95
  tables = [x.lower().replace(suffix,"") for x in files]
94
96
  return (tables)
95
97
 
96
- def generate_table_dict(self):
98
+ def generate_table_dict(self, id_column_name="id"):
97
99
  tables = self.get_all_tables()
98
100
  table_dict = dict()
99
101
  for i, table in enumerate(tables):
100
- table_dict[table] = XlsxTable.init_all_columns(self, table)
102
+ table_dict[table] = XlsxTable.init_all_columns(self, table, id_column_name)
101
103
  return (table_dict)
102
104
 
103
105
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbhydra
3
- Version: 2.0.12
3
+ Version: 2.0.13
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.0.12',
8
+ version='2.0.13',
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