Metadata-Version: 2.1
Name: python-prakashravip1
Version: 1.0.4
Summary: Common Python Utility and Client Tools
Home-page: https://github.com/ravip18596/ravi-python-clients
License: Apache-2.0
Author: ravipnsit
Author-email: prakashravip1@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: delta-spark (==1.2.1)
Project-URL: Repository, https://github.com/ravip18596/ravi-python-clients
Description-Content-Type: text/markdown

# ravi-python-clients

Assortment of python client for personal or business use

## Current Facilities

1) Logger with unique identifier per session

## Windows Installation

```commandline
py -m venv venv
source venv\Scripts\activate
py -m pip install python-prakashravip1
```

## Linux/ Mac Installation

```bash
python -m venv venv
source venv/bin/activate
pip install python-prakashravip1
```

## Example

### Delta Lake Write client

1) Create/Delete Delta Lake Database
```python
from src.delta_lake.delta_lake_spark import create_database, delete_database

DB_NAME = "food_db"

create_database(DB_NAME)
delete_database(DB_NAME)
```

2) Create Delta Lake Table
```python
from src.delta_lake.delta_lake_spark import create_database, create_table_with_schema

DB_NAME = "food_db"
TABLE_NAME = "indian_food"

create_database(DB_NAME)
create_table_with_schema(db=DB_NAME, table=TABLE_NAME,
     schema=[("food_type", "STRING"), ("name", "STRING"), ("price", "FLOAT")],
     partition_cols=["food_type"])
```

### Logging

```python
from utils.logger import logger

logger.info("test info log")
```

```python
from utils.trace_logger import get_trace_logger

test_trace_id = "1234"
logger = get_trace_logger(test_trace_id)
logger.info(f"test info log with trace_id. {test_trace_id}")        
```

