db-toolkit 0.0.4__tar.gz → 0.0.5__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.
@@ -1,40 +1,24 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: db-toolkit
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: utility tools for db access and data extraction
5
- Home-page: https://github.com/Analytics/db-toolkit
6
- Author: frangs
7
- Author-email: giordanofrancisco@duck.com
8
- License: Apache Software License 2.0
9
- Keywords: nbdev jupyter notebook python
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
5
+ Author-email: frangs <giordanofrancisco@duck.com>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/Analytics/db-toolkit
8
+ Project-URL: Documentation, https://Analytics.github.io/db-toolkit
9
+ Keywords: nbdev,jupyter,notebook,python
12
10
  Classifier: Natural Language :: English
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
18
15
  Requires-Python: >=3.9
19
16
  Description-Content-Type: text/markdown
20
17
  License-File: LICENSE
21
18
  Requires-Dist: fastcore
22
19
  Requires-Dist: pandas
23
20
  Requires-Dist: sqlalchemy
24
- Provides-Extra: dev
25
- Dynamic: author
26
- Dynamic: author-email
27
- Dynamic: classifier
28
- Dynamic: description
29
- Dynamic: description-content-type
30
- Dynamic: home-page
31
- Dynamic: keywords
32
- Dynamic: license
33
21
  Dynamic: license-file
34
- Dynamic: provides-extra
35
- Dynamic: requires-dist
36
- Dynamic: requires-python
37
- Dynamic: summary
38
22
 
39
23
  # db-toolkit
40
24
 
@@ -0,0 +1 @@
1
+ __version__ = "0.0.5"
@@ -1,4 +1,6 @@
1
- """Fill in a module description here"""
1
+ """Fill in a module description here
2
+
3
+ Docs: https://Analytics.github.io/db-toolkitcore.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
4
6
 
@@ -1,3 +1,5 @@
1
+ """Docs: https://Analytics.github.io/db-toolkitdb_connec.html.md"""
2
+
1
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_db_connec.ipynb.
2
4
 
3
5
  # %% ../nbs/00_db_connec.ipynb #02ec8b9a-dceb-43eb-abf4-d0b59ab7ded2
@@ -49,7 +51,8 @@ class DBConfig:
49
51
 
50
52
  def read_ms_args(self, key):
51
53
  d = self.cfg[key]
52
- self.connections[key]= dict(server=d['server'], dbname=d['dbname'])
54
+ self.connections[key] = dict(server=d['server'], dbname=d['dbname'],
55
+ user=d.get('user'), pass_=d.get('pass'))
53
56
 
54
57
  def set_connection_orc(self, key):
55
58
  """
@@ -63,18 +66,17 @@ class DBConfig:
63
66
 
64
67
  def set_connection_ms(self, key):
65
68
  """
66
- Set Microsoft SQL Server db connection string for Windows authentication
67
- and set connection using pyodbc.
69
+ Set Microsoft SQL Server db connection string and set connection using pyodbc.
70
+ Supports both Windows authentication (trusted_connection) and SQL authentication (user/pass).
68
71
  https://docs.sqlalchemy.org/en/14/dialects/mssql.html#module-sqlalchemy.dialects.mssql.pyodbc
69
72
  """
70
73
  d = self.connections[key]
71
- cnxn_str = ("Driver={ODBC Driver 17 for SQL Server};" # win + r -> odbcad32.exe -> drivers
72
- f"Server={d['server']};"
73
- f"Database={d['dbname']};"
74
- f"TRUSTED_CONNECTION=yes") # windows oauth
74
+ cnxn_str = f"Driver={{ODBC Driver 17 for SQL Server}};Server={d['server']};Database={d['dbname']};"
75
+ if d['user'] and d['pass_']: cnxn_str += f"UID={d['user']};PWD={d['pass_']};"
76
+ else: cnxn_str += "TRUSTED_CONNECTION=yes;"
75
77
 
76
- cnxn_str2 = sqlalchemy.engine.URL.create("mssql+pyodbc", query={"odbc_connect": cnxn_str})
77
- self.connections[key]['conn'] = sqlalchemy.create_engine(cnxn_str2)
78
+ cnxn_url = sqlalchemy.engine.URL.create("mssql+pyodbc", query={"odbc_connect": cnxn_str})
79
+ self.connections[key]['conn'] = sqlalchemy.create_engine(cnxn_url)
78
80
 
79
81
  @staticmethod
80
82
  def file_exists(file_path):
@@ -1,3 +1,5 @@
1
+ """Docs: https://Analytics.github.io/db-toolkitdb_extract.html.md"""
2
+
1
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/02_db_extract.ipynb.
2
4
 
3
5
  # %% ../nbs/02_db_extract.ipynb #02ec8b9a-dceb-43eb-abf4-d0b59ab7ded2
@@ -1,40 +1,24 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: db-toolkit
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: utility tools for db access and data extraction
5
- Home-page: https://github.com/Analytics/db-toolkit
6
- Author: frangs
7
- Author-email: giordanofrancisco@duck.com
8
- License: Apache Software License 2.0
9
- Keywords: nbdev jupyter notebook python
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
5
+ Author-email: frangs <giordanofrancisco@duck.com>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/Analytics/db-toolkit
8
+ Project-URL: Documentation, https://Analytics.github.io/db-toolkit
9
+ Keywords: nbdev,jupyter,notebook,python
12
10
  Classifier: Natural Language :: English
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
18
15
  Requires-Python: >=3.9
19
16
  Description-Content-Type: text/markdown
20
17
  License-File: LICENSE
21
18
  Requires-Dist: fastcore
22
19
  Requires-Dist: pandas
23
20
  Requires-Dist: sqlalchemy
24
- Provides-Extra: dev
25
- Dynamic: author
26
- Dynamic: author-email
27
- Dynamic: classifier
28
- Dynamic: description
29
- Dynamic: description-content-type
30
- Dynamic: home-page
31
- Dynamic: keywords
32
- Dynamic: license
33
21
  Dynamic: license-file
34
- Dynamic: provides-extra
35
- Dynamic: requires-dist
36
- Dynamic: requires-python
37
- Dynamic: summary
38
22
 
39
23
  # db-toolkit
40
24
 
@@ -2,8 +2,6 @@ LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
4
  pyproject.toml
5
- settings.ini
6
- setup.py
7
5
  db_toolkit/__init__.py
8
6
  db_toolkit/_modidx.py
9
7
  db_toolkit/core.py
@@ -13,6 +11,5 @@ db_toolkit.egg-info/PKG-INFO
13
11
  db_toolkit.egg-info/SOURCES.txt
14
12
  db_toolkit.egg-info/dependency_links.txt
15
13
  db_toolkit.egg-info/entry_points.txt
16
- db_toolkit.egg-info/not-zip-safe
17
14
  db_toolkit.egg-info/requires.txt
18
15
  db_toolkit.egg-info/top_level.txt
@@ -1,5 +1,3 @@
1
1
  fastcore
2
2
  pandas
3
3
  sqlalchemy
4
-
5
- [dev]
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "db-toolkit"
7
+ dynamic = ["version"]
8
+ description = "utility tools for db access and data extraction"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {text = "Apache-2.0"}
12
+ authors = [{name = "frangs", email = "giordanofrancisco@duck.com"}]
13
+ keywords = ['nbdev', 'jupyter', 'notebook', 'python']
14
+ classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
15
+ dependencies = ['fastcore', 'pandas', 'sqlalchemy']
16
+
17
+ [project.urls]
18
+ Repository = "https://github.com/Analytics/db-toolkit"
19
+ Documentation = "https://Analytics.github.io/db-toolkit"
20
+
21
+ [project.entry-points.nbdev]
22
+ db_toolkit = "db_toolkit._modidx:d"
23
+
24
+ [tool.setuptools.dynamic]
25
+ version = {attr = "db_toolkit.__version__"}
26
+
27
+ [tool.setuptools.packages.find]
28
+ include = ["db_toolkit"]
29
+
30
+ [tool.nbdev]
@@ -1 +0,0 @@
1
- __version__ = "0.0.4"
@@ -1,3 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=64.0"]
3
- build-backend = "setuptools.build_meta"
@@ -1,38 +0,0 @@
1
- [DEFAULT]
2
- repo = db-toolkit
3
- lib_name = db-toolkit
4
- version = 0.0.4
5
- min_python = 3.9
6
- license = apache2
7
- black_formatting = False
8
- doc_path = _docs
9
- lib_path = db_toolkit
10
- nbs_path = nbs
11
- recursive = True
12
- tst_flags = notest
13
- put_version_in_init = True
14
- update_pyproject = True
15
- branch = main
16
- custom_sidebar = False
17
- doc_host = https://Analytics.github.io
18
- doc_baseurl = /db-toolkit
19
- git_url = https://github.com/Analytics/db-toolkit
20
- title = db-toolkit
21
- audience = Developers
22
- author = frangs
23
- author_email = giordanofrancisco@duck.com
24
- copyright = 2025 onwards, frangs
25
- description = utility tools for db access and data extraction
26
- keywords = nbdev jupyter notebook python
27
- language = English
28
- status = 3
29
- user = Analytics
30
- requirements = fastcore pandas sqlalchemy
31
- readme_nb = index.ipynb
32
- allowed_metadata_keys =
33
- allowed_cell_metadata_keys =
34
- jupyter_hooks = False
35
- clean_ids = True
36
- clear_all = False
37
- skip_procs =
38
-
db_toolkit-0.0.4/setup.py DELETED
@@ -1,64 +0,0 @@
1
- from pkg_resources import parse_version
2
- from configparser import ConfigParser
3
- import setuptools, shlex
4
- assert parse_version(setuptools.__version__)>=parse_version('36.2')
5
-
6
- # note: all settings are in settings.ini; edit there, not here
7
- config = ConfigParser(delimiters=['='])
8
- config.read('settings.ini', encoding='utf-8')
9
- cfg = config['DEFAULT']
10
-
11
- cfg_keys = 'version description keywords author author_email'.split()
12
- expected = cfg_keys + "lib_name user branch license status min_python audience language".split()
13
- for o in expected: assert o in cfg, "missing expected setting: {}".format(o)
14
- setup_cfg = {o:cfg[o] for o in cfg_keys}
15
-
16
- licenses = {
17
- 'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'),
18
- 'mit': ('MIT License', 'OSI Approved :: MIT License'),
19
- 'gpl2': ('GNU General Public License v2', 'OSI Approved :: GNU General Public License v2 (GPLv2)'),
20
- 'gpl3': ('GNU General Public License v3', 'OSI Approved :: GNU General Public License v3 (GPLv3)'),
21
- 'bsd3': ('BSD License', 'OSI Approved :: BSD License'),
22
- }
23
- statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha',
24
- '4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ]
25
- py_versions = '3.6 3.7 3.8 3.9 3.10 3.11 3.12'.split()
26
-
27
- requirements = shlex.split(cfg.get('requirements', ''))
28
- if cfg.get('pip_requirements'): requirements += shlex.split(cfg.get('pip_requirements', ''))
29
- min_python = cfg['min_python']
30
- lic = licenses.get(cfg['license'].lower(), (cfg['license'], None))
31
- dev_requirements = (cfg.get('dev_requirements') or '').split()
32
-
33
- package_data = dict()
34
- pkg_data = cfg.get('package_data', None)
35
- if pkg_data:
36
- package_data[cfg['lib_name']] = pkg_data.split() # split as multiple files might be listed
37
- # Add package data to setup_cfg for setuptools.setup(..., **setup_cfg)
38
- setup_cfg['package_data'] = package_data
39
-
40
- setuptools.setup(
41
- name = cfg['lib_name'],
42
- license = lic[0],
43
- classifiers = [
44
- 'Development Status :: ' + statuses[int(cfg['status'])],
45
- 'Intended Audience :: ' + cfg['audience'].title(),
46
- 'Natural Language :: ' + cfg['language'].title(),
47
- ] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []),
48
- url = cfg['git_url'],
49
- packages = setuptools.find_packages(),
50
- include_package_data = True,
51
- install_requires = requirements,
52
- extras_require={ 'dev': dev_requirements },
53
- dependency_links = cfg.get('dep_links','').split(),
54
- python_requires = '>=' + cfg['min_python'],
55
- long_description = open('README.md', encoding='utf-8').read(),
56
- long_description_content_type = 'text/markdown',
57
- zip_safe = False,
58
- entry_points = {
59
- 'console_scripts': cfg.get('console_scripts','').split(),
60
- 'nbdev': [f'{cfg.get("lib_path")}={cfg.get("lib_path")}._modidx:d']
61
- },
62
- **setup_cfg)
63
-
64
-
File without changes
File without changes
File without changes
File without changes