Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Tools we use at Somenergia and can be useful

Project Description

This module includes different Python modules and scripts ubiquiously used on scripts in SomEnergia cooperative but with no entity by themselves to have their own repository.

  • venv: run a command under a Python virtual enviroment
  • script to run parametrized sql queries and get the result as (tab separated) csv.
  • module with db related functions
    • fetchNs: a generator that wraps db cursors to fetch objects with attributes instead of psycopg arrays
    • nsList: uses the former to build a list of such object (slower but maybe convinient)
    • csvTable: turns the results of a query into a tab separated table with proper header names
  • convenience class to retrieve data from gdrive spreadshets

venv script

This script is useful to run Python scripts under a given virtual environment. It is specially useful to run Python scripts from crontab lines.


Runs an SQL file and outputs the result of the query as tabulator separated csv.a

You can provide query parameters either as yamlfile or as commandline options. <sqlfile> [<yamlfile>] [--<var1> <value1> [--<var2> <value2> ..] ]

dbutils Python module

Convenient cursor wrappers to make the database access code more readable.


import psycopg2, dbutils
db = psycopg2.connect(**dbconfiguration)
with db.cursor() as cursor :
    cursor.execute("SELECT name, age FROM people")
    for person as dbutils.fetchNs(cursor):
        if person.age < 21: continue
        print("{name} is {age} years old".format(person))

sheetfetcher Python module

Convenient wraper for gdrive.

from sheetfetcher import SheetFetcher

fetcher = SheetFetcher(
    documentName='My Document',
table = fetcher.get_range("My Sheet", "A2:F12")
fulltable = fetcher.get_fullsheet("My Sheet")

Release History

This version
History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(4.5 kB) Copy SHA256 Hash SHA256
Source None Jun 9, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate