Simple API to access to existing astronomical MySQL database
Project description
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
-
Perform a
pip install
,$ pip install astroSQL
Check the version installed:
$ pip show astroSQL
-
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
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.