semvec/pypi-packages huggingface dataset:
FutureLog 0.1.1
Consume logs by block in async application
License: MIT
Requires Python: >=3.6

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# Installation

```pip install futurelog```

# Usage

## Introduction

The goal of this library is to provide a way to defer logs and consume (print) them when needed, in an async application.

For instance, it would perfectly fit a config deployer in async. It would help to keep messages grouped by servers.

Usage should be limited to reporting and not error/exception logging.
Also you should ensure you catch all possible exception in your program in your entrypoint, in order to consume all logs before exiting your application.

## Create a logger

```python
from futurelog import FutureLogger

future_logger = FutureLogger(__name__)
```

## Register logs

The methods supported are: `.debug()`, `.info()`, `.warning()`, `.error()`, `.critical()`

```python
future_logger.debug(topic, msg)
```

Example:
```python
future_logger.debug("server1", "deploying stuff 1")
future_logger.error("server1", "failed")
future_logger.debug("server2", "deploying stuff 1")
future_logger.warning("server2", "success")
```

## Consume logs

### One specific logger

```python
logger.consume(topic)
```

Example:
```python
future_logger.consume("server1")
future_logger.consume("server2")
```

### All loggers for a topic (one for each module)

```python
FutureLogger.consume_all_logger_for(topic)
```

```python
FutureLogger.consume_all_logger_for("server1")
FutureLogger.consume_all_logger_for("server2")
```

### All unconsumed logger

```python
FutureLogger.consume_all_logger()
```
swap-inserter-talenttech-oss 0.0.4
Custom insert for script in vertica/ch
License: MIT
Requires Python: >=3.6

Библиотека для вставки в таблицы, используя промежуточную
========================================================


Типы СУБД для вставки:
-------------
* clickhouse
* vertica 


Аргументы :
-------------
1. script - код для вставки, тип: string
2. sql_credentials - sql-креды для вставки, тип: json
3. insert_table -  имя таблицы, в которую идет вставка, тип: string
4. add_args - аргументы для замены переменных в скрипте, тип: json


Usage
```sh
pip3 install swap-inserter-talenttech-oss
```

SQL CREDENTIALS:
-------------
```python
sql_credentials = {
            "vertica": {
                "database": <VERTICA_DATABASE>,
                "schema": <VERTICA_SCHEMA>,
                "staging_schema": <VERTICA_STAGING_SCHEMA>,
                "user": <VERTICA_WRITE_USER>,
                "host": <VERTICA_HOST>,
                "port": <VERTICA_PORT>,
                "password": <VERTICA_WRITE_PASSWORD>,
                "vertica_configs": {"host": <VERTICA_HOST>,
                                    "port": <VERTICA_PORT>,
                                    "backup_server_node": [<SERVER_NODE_1>, <SERVER_NODE_2>, <SERVER_NODE_3>},
            },
            "ch": {
                "database": <CH_DATABASE>,
                "user": <CH_WRITE_USER>,
                "host": <CH_HOST_A>,
                "port": <CH_PORT_TCP>,
                "password": <CH_WRITE_PASSWORD>,
                "alt_hosts": "{},{}:{}".format(
                    <CH_HOST_B>,
                    <CH_HOST_C>,
                    <CH_PORT_TCP>,
                ),
            },
        }
```      

ПРИМЕР ИСПОЛЬЗОВАНИЯ VERTICA:
-------------
```python
from inserter.vertica_swap_inserter import VerticaSwapInserter

script = "SELECT <FIELDS> FROM {schema}.{from_table}"
inserter = VerticaSwapInserter(
            script=script,
            sql_credentials=sql_credentials["vertica"],
            insert_table=<TABLE_INSERT>,
            add_args={
                "schema": sql_credentials["vertica"]["schema"],
                "from_table": <FROM_TABLE>
            }
        )
        inserter.run()
```  

ПРИМЕР ИСПОЛЬЗОВАНИЯ CH:
-------------
```python
from inserter.ch_swap_inserter import CHSwapInserter

script = "SELECT <FIELDS> FROM {schema}.{from_table}"
inserter = CHSwapInserter(
            script=script,
            sql_credentials=sql_credentials["ch"],
            insert_table=<TABLE_INSERT>,
            add_args={
                "database": sql_credential["ch"]["database"],
                "from_table": <FROM_TABLE>
            },
        )
        inserter.run()
```