Skip to main content

kdb+ connections within a Flask application.

Project description

Flask & KDB (qPython3 | finos)

A repo designed to how to connect your Flask app to a q/KDB+ process using the finos python/kdb library - qPython3

Install

pip install Flask-kdb

Configuration

Thisis just a very basic showcase. Currently these envirnoment variables are used:

KDB_HOST
KDB_PORT

Usage

Import the class FlaskKDB and initialize using by using the constructor:

from flask import Flask
from flask_kdb import FlaskKDB

app = Flask(__name__)
app.config['KDB_HOST'] = 'localhost'
app.config['KDB_PORT'] = 5000
kdb = FlaskKDB(app)

or delayed initialisation (via init_app):

app = Flask(__name__)
app.config['KDB_HOST'] = 'localhost'
app.config['KDB_PORT'] = 5000

kdb = FlaskKDB()
kdb.init_app(app)

The first method is uses a persistant DB connection object that can be imported when required. I implemented this from this answer from toppatopvt on StackOverflow

References

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

Flask-kdb-1.0.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

Flask_kdb-1.0.0-py3-none-any.whl (3.4 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