DE-Lib 0.0.35.4__tar.gz → 0.0.36.1__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 (54) hide show
  1. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_LIB.egg-info/PKG-INFO +1 -1
  2. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_LIB.egg-info/SOURCES.txt +1 -0
  3. de_lib-0.0.36.1/DE_Lib/DataBase/OracleDDL.py +90 -0
  4. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/PKG-INFO +1 -1
  5. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/setup.py +1 -1
  6. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_LIB.egg-info/dependency_links.txt +0 -0
  7. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_LIB.egg-info/requires.txt +0 -0
  8. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_LIB.egg-info/top_level.txt +0 -0
  9. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Cloud/__init__.py +0 -0
  10. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Azure.py +0 -0
  11. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Cache.py +0 -0
  12. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Firebird.py +0 -0
  13. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Informix.py +0 -0
  14. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Metadata.py +0 -0
  15. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/MsSql.py +0 -0
  16. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/MySql.py +0 -0
  17. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Oracle.py +0 -0
  18. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/Postgres.py +0 -0
  19. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/RedShift.py +0 -0
  20. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/SQCipher.py +0 -0
  21. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/SQLite.py +0 -0
  22. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/DataBase/__init__.py +0 -0
  23. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/Avro.py +0 -0
  24. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/Csv.py +0 -0
  25. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/JSon.py +0 -0
  26. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/Parquet.py +0 -0
  27. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/Txt.py +0 -0
  28. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/Xlsx.py +0 -0
  29. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/Zip.py +0 -0
  30. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Files/__init__.py +0 -0
  31. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Log/DE_LogEventos.py +0 -0
  32. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Log/Level.py +0 -0
  33. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Log/Log.py +0 -0
  34. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Log/__init__.py +0 -0
  35. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Aes.py +0 -0
  36. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Argon.py +0 -0
  37. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Base64.py +0 -0
  38. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Cipher.py +0 -0
  39. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Fernet.py +0 -0
  40. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Gcm.py +0 -0
  41. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Pbkdf2.py +0 -0
  42. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/Rsa.py +0 -0
  43. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Cipher/__init__.py +0 -0
  44. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Colors.py +0 -0
  45. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/DateUtils.py +0 -0
  46. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Generic.py +0 -0
  47. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/Sql.py +0 -0
  48. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/System.py +0 -0
  49. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/WebHook.py +0 -0
  50. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/Utils/__init__.py +0 -0
  51. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/DE_Lib/__init__.py +0 -0
  52. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/LICENCE +0 -0
  53. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/README.md +0 -0
  54. {de_lib-0.0.35.4 → de_lib-0.0.36.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DE_Lib
3
- Version: 0.0.35.4
3
+ Version: 0.0.36.1
4
4
  Summary: Biblioteca de funcionalidades
5
5
  Home-page: https://github.com/DE-DATAx/DAX_DB.git
6
6
  Author: Almir J Gomes
@@ -21,6 +21,7 @@ DE_Lib/DataBase/Metadata.py
21
21
  DE_Lib/DataBase/MsSql.py
22
22
  DE_Lib/DataBase/MySql.py
23
23
  DE_Lib/DataBase/Oracle.py
24
+ DE_Lib/DataBase/OracleDDL.py
24
25
  DE_Lib/DataBase/Postgres.py
25
26
  DE_Lib/DataBase/RedShift.py
26
27
  DE_Lib/DataBase/SQCipher.py
@@ -0,0 +1,90 @@
1
+ from logging import exception
2
+
3
+ import pandas as pd
4
+
5
+ class OracleDDL:
6
+ def __init__(self):
7
+ msg = result = None, None
8
+ try:
9
+ ...
10
+ except Exception as error:
11
+ msg = error
12
+ result = msg
13
+ finally:
14
+ print(result)
15
+
16
+
17
+ def map_dtype_to_oracle(self, dtype):
18
+ msg = result = None, None
19
+ try:
20
+ if pd.api.types.is_integer_dtype(dtype):
21
+ result = "NUMBER"
22
+ elif pd.api.types.is_float_dtype(dtype):
23
+ result = "FLOAT"
24
+ elif pd.api.types.is_bool_dtype(dtype):
25
+ result = "CHAR(1)" # True = 'Y', False = 'N'
26
+ elif pd.api.types.is_string_dtype(dtype):
27
+ result = "VARCHAR2(255)"
28
+ elif pd.api.types.is_datetime64_any_dtype(dtype):
29
+ result = "DATE"
30
+ else:
31
+ result = "VARCHAR2(4000)"
32
+ result = "VARCHAR2(4000)"
33
+ except Exception as error:
34
+ msg = error
35
+ result = msg
36
+ finally:
37
+ return result
38
+
39
+ def generate_create_table_sql(self, table_name, df):
40
+ msg = result = None, None
41
+ try:
42
+ columns = []
43
+ for col in df.columns:
44
+ colname = col.lower()
45
+ oracle_type = self.map_dtype_to_oracle(df[col].dtype)
46
+ columns.append(f"{colname} {oracle_type}")
47
+ columns_sql = ",\n ".join(columns)
48
+ result = f"CREATE TABLE {table_name} (\n {columns_sql}\n)"
49
+ except Exception as error:
50
+ msg = error
51
+ result = msg
52
+ finally:
53
+ return result
54
+
55
+ def prepare_data_for_insert(self, df):
56
+ msg = result = None, None
57
+ try:
58
+ def convert_row(row):
59
+ return tuple(
60
+ 'Y' if isinstance(val, bool) and val else 'N' if isinstance(val, bool) else val for val in row)
61
+ result = [convert_row(row) for row in df.itertuples(index=False, name=None)]
62
+ except Exception as error:
63
+ msg = error
64
+ result = msg
65
+ finally:
66
+ return result
67
+
68
+ def create_table_and_insert_data(self, df, table_name, conn):
69
+ msg = result = None, None
70
+ try:
71
+ cur = conn.cursor()
72
+ try:
73
+ create_sql = self.generate_create_table_sql(table_name, df)
74
+ cur.execute(create_sql)
75
+ except:
76
+ pass #cur.execute(f"DROP TABLE {table_name}")
77
+
78
+ placeholders = ', '.join([f":{i+1}" for i in range(len(df.columns))])
79
+ insert_sql = f"INSERT INTO {table_name} VALUES({placeholders})"
80
+ data = self.prepare_data_for_insert(df)
81
+ cur.executemany(insert_sql, data)
82
+ conn.commit()
83
+ cur.close()
84
+ conn.close()
85
+
86
+ except Exception as error:
87
+ msg = error
88
+ result = msg
89
+ finally:
90
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DE_Lib
3
- Version: 0.0.35.4
3
+ Version: 0.0.36.1
4
4
  Summary: Biblioteca de funcionalidades
5
5
  Home-page: https://github.com/DE-DATAx/DAX_DB.git
6
6
  Author: Almir J Gomes
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
  setup(
3
3
  name='DE_Lib',
4
- version='0.0.35.4',
4
+ version='0.0.36.1',
5
5
  author='Almir J Gomes',
6
6
  author_email='almir.jg@hotmail.com',
7
7
  packages=find_packages(),
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes