Skip to main content

GREECE utils

Project description


A set of common but yet useful generic tools


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"]]))
  • 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.

Source Distribution

greece-utils-0.2.tar.gz (10.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page