GREECE utils
Project description
greece-utils
A set of common but yet useful generic tools
Examples:
Convert SQL database table to CSV file
Implement recursive mapping of all foreign key tables (join of all related tables)
>>> from utils.toolset import SqlCsv
>>> my_object = SqlCsv(engine, session)
>>> my_object.to_csv("my_table_name", "path/to/file.csv", map_foreign_key_tables=True)
Find files in directory
from utils.sys import find_file
- Look for file extension in current directory
>>> find_file(".py")
- Look for file name(s) in specific directory
>>> find_file("filename", "/path/to/valid/directory")
- Look for multiple file names/extension in current directory
>>> list(set([item for item in find_file(ext) for ext in ["filename", ".py"]]))
Log
- Print standard output error to log file
>>> from utils.sys import StreamToLogger
>>> import logging
>>> log = StreamToLogger(logging.getLogger('STDERR'), name=log_name, log_level=logging.ERROR)
>>> sys.stderr = log
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
greece-utils-0.2.tar.gz
(10.6 kB
view details)
File details
Details for the file greece-utils-0.2.tar.gz
.
File metadata
- Download URL: greece-utils-0.2.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a0317fed557dabcaa9a0d35f4e791e45c2de2d496072c464053bef8354e863 |
|
MD5 | f849201c26e70156ed0dbe366ed07a87 |
|
BLAKE2b-256 | f60880bc737a7a6570a882e2e4941853cd2eaa3c3eee086b5a8688203bb970b0 |