{
"info": {
"author": "Matias Carrasco Kind",
"author_email": "mcarras2@illinois.edu",
"bugtrack_url": null,
"classifiers": [],
"description": "# easyaccess
   [](https://doi.org/10.21105/joss.01022)\n\nEnhanced command line SQL interpreter client for astronomical surveys.\n\n\n## Description\n`easyaccess` is an enhanced command line interpreter and Python package created to facilitate access to astronomical catalogs stored in SQL Databases. It provides a custom interface with custom commands and was specifically designed to access data from the Dark Energy Survey Oracle database, including autocompletion of tables, columns, users and commands, simple ways to upload and download tables using csv, fits and HDF5 formats, iterators, search and description of tables among others. It can easily be extended to another surveys or SQL databases. The package was completely written in Python and support customized addition of commands and functionalities.\n\nFor a short tutorial check [here](http://matias-ck.com/easyaccess)\n\n**Current version = 1.4.7**\n\n#### DES DR1 users\nFor DES public data release, you can start `easyaccess` with:\n\n easyaccess -s desdr\n\nTo create an account click [here](https://des.ncsa.illinois.edu/easyweb/signup/).\n\n## Requirements\n\n- [Oracle Client](https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html) > 11g.2 (External library, no python)\n Check [here](https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html) for instructions on how to install these libraries\n- [cx_Oracle](https://cx-oracle.readthedocs.io/en/latest/index.html)\n - Note that cx_Oracle needs libaio on some Linux systems\n - Note that cx_Oracle needs libbz2 on some Linux systems\n- [fitsio](https://github.com/esheldon/fitsio) >= 0.9.6\n- [pandas](http://pandas.pydata.org/) >= 0.14\n- [numpy](https://docs.scipy.org/doc/numpy-1.15.1/reference/index.html)\n- [termcolor](https://pypi.python.org/pypi/termcolor)\n- [PyTables](http://pytables.github.io/) (optional, for hdf5 output)\n- [future](http://python-future.org/) (for python 2/3 compatibility)\n- [requests](http://docs.python-requests.org/en/master/)\n- [gnureadline](https://github.com/ludwigschwardt/python-gnureadline) (optional, for better console behavior in OS X)\n\n## Installation\n\nInstalling `easyaccess` can be a little bit tricky given the external libraries required, in particular the Oracle libraries which are free to use. `easyaccess` is based heavily on the Oracle python client `cx_Oracle`, you can follow the installation instructions from [here](https://cx-oracle.readthedocs.io/en/latest/installation.html#quick-start-cx-oracle-installation). For `cx_Oracle` to work, you will need the Oracle Instant Client packages which can be obtained from [here](https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html).\n\nMake sure you have these libraries installed before proceeding to the installation of easyaccess, you can try by opening a Python interpreter and type:\n\n import cx_Oracle\n\nIf you have issues, please check the [Troubleshooting page](https://cx-oracle.readthedocs.io/en/latest/installation.html#troubleshooting) or our [FAQ page](FAQ.md).\n\n#### Source Installation\n\nYou can clone this repository and install `easyaccess` with:\n\n python setup.py install\n\n#### Pip installation\n`easyaccess` can also be installed using `pip` but it'd require the installation of the oracle instant client first as described above\n\n pip install easyaccess==1.4.7\n\nor directly from github:\n\n pip install git+https://github.com/mgckind/easyaccess.git\n\n#### Conda installation\nFor Collaborators, now easyaccess can be installed using [conda](http://conda.pydata.org/docs/install/quick.html) out of the box!\n\n conda install easyaccess==1.4.7 -c mgckind -c anaconda\n\n#### Docker\nFor collaborators, We have a Docker image with easyaccess pre-installed which you can obtained from:\n\n docker pull mgckind/easyaccess\n\n## FAQ\nWe have a running list of [FAQ](FAQ.md) which we will constantly update, please check [here](FAQ.md).\n\n#### Contributing\nPlease take a look st our [Code of Conduct](CODE_OF_CONDUCT.md) and or [contribution guide](CONTRIBUTING.md).\n\n\n## Citation\nIf you use `easyaccess` in your work we would encourage to use this reference [https://arxiv.org/abs/1810.02721](https://arxiv.org/abs/1810.02721) or copy/paste this BibTeX:\n```\n@ARTICLE{2018arXiv181002721C,\n author = {{Carrasco Kind}, M. and {Drlica-Wagner}, A. and {Koziol}, A.~M.~G. and\n {Petravick}, D.},\n title = \"{easyaccess: Enhanced SQL command line interpreter for astronomical surveys}\",\n journal = {arXiv e-prints},\n keywords = {Astrophysics - Instrumentation and Methods for Astrophysics},\n year = 2018,\n month = Oct,\n eid = {arXiv:1810.02721},\n pages = {arXiv:1810.02721},\narchivePrefix = {arXiv},\n eprint = {1810.02721},\n primaryClass = {astro-ph.IM},\n adsurl = {https://ui.adsabs.harvard.edu/\\#abs/2018arXiv181002721C},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n```\n\n\n## Usage\n\nFor a short tutorial and documentation see [here](http://matias-ck.com/easyaccess), note that not all the features are available for the public use, i.e., DR1 users.\n\n#### Some *great* features\n- Nice output format (using pandas)\n- Very flexible configuration\n- Smart tab autocompletion for commands, table names, column names, and file paths\n- Write output results to CSV, TAB, FITS, or HDF5 files\n- Load tables from CSV, FITS or HDF5 files directly into DB (memory friendly by using number of rows or memory limit)\n- Intrinsic DB commands to describe tables, schema, quota, and more\n- Easyaccess can be imported as module from Python with a complete Python API\n- Run commands directly from command line\n- Load SQL queries from a file and/or from the editor\n- Show the execution plan of a query if needed\n- Python functions can be run in a inline query\n\n\n#### Interactive interpreter\n\nAssuming that ```easyaccess``` is in your path, you can enter the interactive interpreter by calling ```easyaccess``` without any command line arguments:\n\n easyaccess\n\n#### Running SQL commands\nOnce inside the interpreter run SQL queries by adding a \";\" at the end::\n\n DESDB ~> select ... from ... where ... ;\n\nTo save the results into a table add \">\" after the end of the query (after \";\") and namefile at the end of line\n\n DESDB ~> select ... from ... where ... ; > test.fits\n\nThe file types supported so far are: .csv, .tab, .fits, and .h5. Any other extension is ignored.\n\n#### Load tables\nTo load a table it needs to be in a csv format with columns names in the first row\nthe name of the table is taken from filename or with optional argument --tablename\n\n DESDB ~> load_table --tablename --chunksize --memsize \n\nThe --chunsize and --memsize are optional arguments to facilitate uploading big files.\n\n#### Load SQL queries\nTo load SQL queries just run:\n\n DESDB ~> loadsql \nor\n\n DESDB ~> @filename.sql\n\nThe query format is the same as the interpreter, SQL statement must end with \";\" and to write output files the query must be followed by \" >