{ "info": { "author": "Michael Imelfort", "author_email": "mike@mikeimelfort.com", "bugtrack_url": null, "classifiers": [], "description": "# DancingPeasant\n\n## Overview\n\nThis is a living / functional experiment in moving bioinformatics workflows away from multiple CSV files and towards SQL (specifically SQLite).\nDancingPeasant consists of two main classes: BaseFile and Interface\n\nBaseFile is a base class that enables packaging of several csv-type files into one SQLite database. It supports creation, addition of tables, versioning and history.\nInterface is a base class that provides access (currently insert / select / update) to the tables in BaseFile.\n\n## Installation\n\nDancingPeasant depends only on Python core libraries and it's on PIP. so just:\n\n $ pip install DancingPeasant\n\n## Example usage\n\nYou should make your classes derive from BaseFile and Interface. Suppose you want to make a new db-based file format called a foofile (*.ff). First you need to extend the BaseClass:\n\nSomewhere within your \"foo\" package you should make a file called \"db.py\" with the following contents:\n\n # Always version your files!\n __FOO_DB_VERSION__ = \"1.0.0\"\n\n from dancingPeasant.baseFile import BaseFile\n from dancingPeasant.exceptions import *\n\n class FooDB(BaseFile):\n def __init__(self, verbosity=0):\n BaseFile.__init__(self, verbosity)\n\n def createNewFile(self,\n fileName, # name of the new file\n force=False, # should we check to see if this is a wise move?\n ):\n \"\"\"Create a new Foo database file\"\"\"\n # make a basic file\n BaseFile.createNewFile(self,\n fileName,\n type=\"Foo_DB\",\n version=__FOO_DB_VERSION__,\n force=force)\n\n # add Foo specific tables\n self._addTable(\"bars\", # the name of the table\n {\n \"length\" : \"INT\", # Specify column names and\n \"diameter\" : \"INT\", # standard SQL syntax for the type\n \"material\" : \"TEXT\", # As may as you like\n },\n force=True)\n\n # Keep adding tables\n ...\n\n\nTo read and write from this file you'll need to extend the Interface class.\nMake a file called importer.py with the following contents:\n\n from dancingPeasant.exceptions import *\n from dancingPeasant.interface import Interface\n from dancingPeasant.interface import Condition\n from foo.db import FooDB # <--- NOTE: foo is the name of your package and FooDB is the name of your file class\n\nclass FooInterface(Interface):\n \"\"\"Use this interface for importing data stored in csv\n files into the TrackM DB\"\"\"\n\n def __init__(self,\n dbFileName, # file name to connect to\n verbosity=-1 # turn off all DP chatter\n ):\n Interface.__init__(self, dbFileName, verbosity)\n self.db = FooDB(verbosity=verbosity) # <-- This line is important!\n\n def addBars(self, bars):\n \"\"\"Add bars to the database\"\"\"\n # connect to the database\n self.connect()\n\n # bars is an array of tuples. All ordered in the same way\n # EX:\n # [(10, 1, \"iron\"), (20, 15, \"wax\"), ... ]\n #\n self.insert(\"bars\",\n [\"length\",\n \"diameter\",\n \"material\"],\n bars)\n\n # disconnect once done\n self.disconnect()\n\n def getBars(self, length):\n \"\"\"Get bars longer tha a set length\"\"\"\n\n # connect to the database\n self.connect()\n\n # set the select condition\n C = Condition(\"length\", \">\", length)\n\n # access the database and get rows\n rows = self.select('bars', [\"material\", \"diameter\"], C)\n\n # disconnect once done\n self.disconnect()\n\n # do something with the results\n\nThis is just a starter. Hopefully I'll add some more examples here soon but I'm still busy writing it and trying to learn how to use it.\nIn the meantime check out the unit tests in dancngpeasant and the various interfaces and dbs used in TrackM and StoreM for more examples on how I use this class.\n\n## Help\n\nIf you experience any problems using DancingPeasant, open an [issue](https://github.com/minillinim/DancingPeasant/issues) on GitHub and tell us about it.\n\n## Licence\n\nGPL3, with love.\n\nProject home page, info on the source tree, documentation, issues and how to contribute, see http://github.com/minillinim/DancingPeasant\n\n## Copyright\n\nCopyright (c) 2014 Michael Imelfort. See LICENSE.txt for further details.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/DancingPeasant/", "keywords": null, "license": "GPLv3", "maintainer": null, "maintainer_email": null, "name": "DancingPeasant", "package_url": "https://pypi.org/project/DancingPeasant/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/DancingPeasant/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/DancingPeasant/" }, "release_url": "https://pypi.org/project/DancingPeasant/0.1.6/", "requires_dist": null, "requires_python": null, "summary": "Utilities that allow a batch of CSV files to be passed as a single SQLITE db", "version": "0.1.6" }, "last_serial": 1196177, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "510e5d2cca74cf1944f13eda28e536dc", "sha256": "048fc1e78de60d73bc1526dc690b6cec10e1ac1ba8b018df2e9143c60a2e4523" }, "downloads": -1, "filename": "DancingPeasant-0.0.1.tar.gz", "has_sig": false, "md5_digest": "510e5d2cca74cf1944f13eda28e536dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18035, "upload_time": "2014-07-03T16:18:03", "url": "https://files.pythonhosted.org/packages/58/48/a2501da7d0550669fa6031385324ee736f562928de8be19849bcd59584f5/DancingPeasant-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "96cddc5f1c828c7e25a104474b093ee5", "sha256": "bf28174200f3512c9cf9c47932ea52337e6dab443f0a95ce62821467b1fc5e97" }, "downloads": -1, "filename": "DancingPeasant-0.0.2.tar.gz", "has_sig": false, "md5_digest": "96cddc5f1c828c7e25a104474b093ee5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18929, "upload_time": "2014-07-04T00:42:17", "url": "https://files.pythonhosted.org/packages/f3/34/fa5170780d6c2c862dc5441d45fc95aeeefefa53c36a298bc34a3e52b384/DancingPeasant-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "bbf71a3643b300e9bd7720e15912327b", "sha256": "ba17da069f116485b2da023337572ffc8467cce0f5012875cede2f4346e677cb" }, "downloads": -1, "filename": "DancingPeasant-0.0.3.tar.gz", "has_sig": false, "md5_digest": "bbf71a3643b300e9bd7720e15912327b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19513, "upload_time": "2014-07-06T03:54:20", "url": "https://files.pythonhosted.org/packages/e4/57/60af28cc94f883ab0a69f48b8fefa36dabc0a3c8a4211a706db852441605/DancingPeasant-0.0.3.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "f1b299315c2bde896f3d3440b453ce30", "sha256": "20afbf83e300c357508a5e7f9c48c59806532e47b4b703d90095f8782756426c" }, "downloads": -1, "filename": "DancingPeasant-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f1b299315c2bde896f3d3440b453ce30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19677, "upload_time": "2014-07-09T15:33:39", "url": "https://files.pythonhosted.org/packages/02/4f/0a52f9e35512791aca8cd4cb7b26799e2d30ecc0fcd84ea9550fc6fedf78/DancingPeasant-0.1.0.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "d09e8ca2e20d29c91422eb9e4b77bd48", "sha256": "a995498a73e1ede4c0b28d87c3ca650f237a98f6a9e3e8ad46e4abd79916fe33" }, "downloads": -1, "filename": "DancingPeasant-0.1.3.tar.gz", "has_sig": false, "md5_digest": "d09e8ca2e20d29c91422eb9e4b77bd48", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19914, "upload_time": "2014-07-28T03:23:30", "url": "https://files.pythonhosted.org/packages/b4/4e/2d9058d876d26f9326a650c713e4ebff1854dafb8a35ea52873bdc97781a/DancingPeasant-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "bd6e1a47e19c21d171167fb31e5b7166", "sha256": "9d650ba4e61477760bad24e7b70842191806fbd03a38f2f19f076a0933ac2cac" }, "downloads": -1, "filename": "DancingPeasant-0.1.4.tar.gz", "has_sig": false, "md5_digest": "bd6e1a47e19c21d171167fb31e5b7166", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22420, "upload_time": "2014-07-30T03:09:16", "url": "https://files.pythonhosted.org/packages/9b/20/048d628a21d9010089b9ae973c3ddc760374e6a40f1f455466705d1e8951/DancingPeasant-0.1.4.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "3b43adb51bdc7ff377365a85dd51c7a2", "sha256": "c0c695924616e1f654541907935f4b62c503fc769a8ee7eec9aae48a3ef786a3" }, "downloads": -1, "filename": "DancingPeasant-0.1.6.tar.gz", "has_sig": false, "md5_digest": "3b43adb51bdc7ff377365a85dd51c7a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22445, "upload_time": "2014-08-20T06:17:45", "url": "https://files.pythonhosted.org/packages/44/99/6e2f2f0ca512709e44a572175e060b5525e6ca63c64f804c0e3d010467ff/DancingPeasant-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3b43adb51bdc7ff377365a85dd51c7a2", "sha256": "c0c695924616e1f654541907935f4b62c503fc769a8ee7eec9aae48a3ef786a3" }, "downloads": -1, "filename": "DancingPeasant-0.1.6.tar.gz", "has_sig": false, "md5_digest": "3b43adb51bdc7ff377365a85dd51c7a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22445, "upload_time": "2014-08-20T06:17:45", "url": "https://files.pythonhosted.org/packages/44/99/6e2f2f0ca512709e44a572175e060b5525e6ca63c64f804c0e3d010467ff/DancingPeasant-0.1.6.tar.gz" } ] }