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 Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page