Skip to main content

Simple API to access to existing astronomical MySQL database

Project description

Build Status

astroSQL - Simple Database Tools for Python

Simple Python API to access existing astronomy MySQL database.

While designed for astronomy, astroSQL can be used for every field.

Features

  • astroSQL Python API:
    • create SQL database table
    • read SQL database table
    • update SQL database table
    • SQL query using peewee ORM
  • astroSQL Shell Command
    • query SQL database to text-based file
    • update SQL database with text-based file  

Dependencies

  • MySQL server
  • Python 3.x

Setup

  1. Perform a pip install,

    $ pip install astroSQL
    

    Check the version installed:

    $ pip show astroSQL
    
  2. Edit the configuration file as necessary in ~/.astrosql/config.yml:

    # Uncomment 'forward' if you want to place config.yml elsewhere, specify the file path (maybe `~/.astrosql/config.yml` ?)
    # forward: '/path/to/config.yml'
    
    # Comment out any unecessary lines, empty will be read
    mysql:
        host: 'localhost'
        user: 'username'
        password: ''
        database: 'database_name'
    

    WARNING: Keep this file secure if password is written

  3. Test setup

    >>> from astrosql.sqlconnector import connect
    >>> from astrosql import AstroSQL
    
    >>> db = AstroSQL(connect()) # connect does not need args as it reads from config.yml
    >>> db.tables.values()
    dict_values(['tb1, tb2, ...']) # should output all table names from your database
    

Usage

See wiki:

References

Filippenko Group - Project Team

The program was built for the Filippenko Group, astronomy researchers led by Alex Filippenko for analyzing data from the Lick Observatory and Keck Observatory.

Project team led by Keto Zhang and Weikang Zheng.

Source Code and Inspiration:

Some parts of the program was provided by and inspired from Issac Shiver and Thomas Tu from the FlipperPhoto repository.

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

astrosql-0.3.0.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

astrosql-0.3.0-py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 3

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