Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for greece-utils, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size greece-utils-0.2.tar.gz (10.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page