refactor-to-mono
Giò Diani 2024-10-27 16:10:49 +01:00
parent d5f8f21308
commit 62fa63d0f5
6 changed files with 33 additions and 6 deletions

3
.gitignore vendored
View File

@ -49,8 +49,7 @@ nb-configuration.xml
__pycache__/
.pytest_cache
*.py[cod]
.env/
.env*
.env
.~env/
.venv
env3.6/

23
pixi.lock generated
View File

@ -38,6 +38,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/plotly-5.24.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.13.0-h9ebbce0_100_cp313.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python-duckdb-1.1.2-py313h46c70d0_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-tzdata-2024.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.13-5_cp313.conda
@ -74,6 +75,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/plotly-5.24.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-64/python-3.13.0-h0608dab_100_cp313.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-64/python-duckdb-1.1.2-py313hc1eae12_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-tzdata-2024.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-64/python_abi-3.13-5_cp313.conda
@ -110,6 +112,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/plotly-5.24.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.13.0-h75c3a9f_100_cp313.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-duckdb-1.1.2-py313h4e5f155_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-tzdata-2024.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.13-5_cp313.conda
@ -146,6 +149,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/pthreads-win32-2.9.1-h2466b09_4.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.13.0-hf5aa216_100_cp313.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python-duckdb-1.1.2-py313h5813708_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/python-tzdata-2024.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.13-5_cp313.conda
@ -312,7 +316,7 @@ packages:
name: consultancy-2
version: 0.1.0
path: .
sha256: 1858b9f8c1dc159a388e18243329187b239c647b7923868f73227b841e330a3e
sha256: 6ffb42ba9596cdfd1545aaa22cb3cd8f9f1c1418b1ac2dbe95f4c00b598b0af9
requires_python: '>=3.11'
editable: true
- kind: conda
@ -1847,6 +1851,23 @@ packages:
- pkg:pypi/python-dateutil?source=hash-mapping
size: 222742
timestamp: 1709299922152
- kind: conda
name: python-dotenv
version: 1.0.1
build: pyhd8ed1ab_0
subdir: noarch
noarch: python
url: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
sha256: 2d4c80364f03315d606a50eddd493dbacc078e21412c2462c0f781eec49b572c
md5: c2997ea9360ac4e015658804a7a84f94
depends:
- python >=3.8
license: BSD-3-Clause
license_family: BSD
purls:
- pkg:pypi/python-dotenv?source=hash-mapping
size: 24278
timestamp: 1706018281544
- kind: conda
name: python-duckdb
version: 1.1.2

View File

@ -24,3 +24,4 @@ numpy = ">=2.1.2,<3"
pandas = ">=2.2.3,<3"
plotly = ">=5.24.1,<6"
duckdb = ">=1.1.2,<2"
python-dotenv = ">=1.0.1,<2"

1
src/.env.example Normal file
View File

@ -0,0 +1 @@
DATABASE="/full/path/to/databse.duckdb"

View File

@ -1,5 +1,10 @@
import os
from dotenv import load_dotenv
from data import database
load_dotenv(dotenv_path='../.env')
def load():
return database.Database()
return database.Database(path=os.getenv('DATABASE'))

View File

@ -2,8 +2,8 @@ import duckdb
class Database:
def __init__(self):
self.connection = duckdb.connect(database = '../data/consultancy.duckdb', read_only = True)
def __init__(self, path):
self.connection = duckdb.connect(database = path, read_only = True)
def db_overview(self):
return self.connection.sql("DESCRIBE;").show()