ketozhang / astroapiserver Goto Github PK
View Code? Open in Web Editor NEWBoilerplate and toolkit to build API server for web data access and data releases fit for astronomy research
License: Apache License 2.0
Boilerplate and toolkit to build API server for web data access and data releases fit for astronomy research
License: Apache License 2.0
astroAPIServer only supports database interfaces specified by Python's DB-API v2.0 (PEP 249). Such python interfaces includes the following python packages:
For example, let's using sqlite3. We instantiate the cursor object by some function get_database
,
# database_handler.py
def get_database(database):
db_path = "/path/to/database.db"
con = sqlite3.connect(db_path)
cursor = con.cursor()
return cursor
astroAPIServer is built with both the Flask object and get_database
.
from flask import Flask
from database_handler import get_database
app = Flask(__name__)
api = API(app, get_database=get_database)
Extends SQL API endpoint to support natural SQL clauses.
The following clauses and keywords should be supported:
SELECT
ORDER BY
DESC
LIMIT
The following clauses and keywords will be left unsupported due to implementation difficulty or simply not recommended for this project:
SELECT
OperatorsSELECT COUNT(*) FROM table
)WHERE
=, >, <, <>, IN
) which is very difficult to support along with SQL injection prevention by placeholders.JOIN
GROUP BY
GROUP BY
requires a aggregation operator/function in the SELECT clause.HAVING
GROUP BY
is not supported.execute_query
function:
...
execute_query(database, query, use_global_parameters=True)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.