Skip to main content

In the name of God, the Most Gracious, the Most Merciful.

PF-Flask-DB

Problem Fighter PF Flask DB (PF-Flask-DB) basically started with a Wrapper of Flask SQLAlchemy, When we try to create a project using Flask that moment we have to think about many area, such as Database, ORM, Migration etc. It's make developer life difficult, this project aim to integrate various library and provide a single but useful solution.




Example Codes

from flask import Flask
from pf_flask_db.pf_app_model import AppModel
from pf_flask_db.pf_app_database import app_db

app = Flask(__name__)

app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///pf-flask-db-quick-start.sqlite"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app_db.init_app(app)


class Person(AppModel):
    first_name = app_db.Column(app_db.String(150), nullable=False)
    last_name = app_db.Column(app_db.String(150))
    email = app_db.Column(app_db.String(120), nullable=False)
    age = app_db.Column(app_db.Integer)
    income = app_db.Column(app_db.Float, default=0)


with app.app_context():
    app_db.create_all()


@app.route('/')
def bismillah():
    return "PF Flask DB Tutorial"


@app.route('/create')
def create():
    person = Person(first_name="First Name", last_name="Last Name", email="hmtmcse.com@gmail.com", age=22, income=500)
    person.save()
    response = "Data successfully Inserted"
    return response


@app.route('/update')
def update():
    person = Person.query.filter_by(id=1).first()
    if person:
        person.first_name = "FName Update"
        person.last_name = "LName Update"
        person.save()
    return "Data has been updated."


@app.route('/delete')
def delete():
    person = Person.query.filter_by(id=1).first()
    if person:
        person.delete()
    return "Record has been deleted"


@app.route('/list')
def list():
    response = ""
    persons = Person.query.all()
    for person in persons:
        response += person.first_name + " " + person.last_name + " " + person.email + "<br>"
    return response


if __name__ == '__main__':
    app.run(debug=True)




Documentation

Install and update using pip:

pip install -U PF-Flask-DB

Please find the Documentation with example from hmtmcse.com




Donate

Problem Fighter develops and supports PF-Flask-DB and the libraries it uses. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects.




Contributing

For guidance on setting up a development environment and how to make a contribution to PF-Flask-DB, see the contributing guidelines.




Links

Release files for PF-Flask-DB 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PF-Flask-DB 1.0.1
File Size Uploaded
PF-Flask-DB-1.0.1.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PF-Flask-DB 1.0.1
File Interpreter ABI Platform
PF_Flask_DB-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / PF-Flask-DB-1.0.1.tar.gz

Download URL PF-Flask-DB-1.0.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
22a73fb495e3a13f5d7fc9b5e4d238a05edbc360351e54969ad4fa3f64297815
BLAKE2b-256 checksum
How to use checksums
145483b5edef208b8a3e032878551058cee9f138d69f4b9dec71a97022a2d52b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release files / PF_Flask_DB-1.0.1-py3-none-any.whl

Download URL PF_Flask_DB-1.0.1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43c8473d5aa7cde2254d77a8bbc3035bf571eb01e69cd0672af75c75902ec1a6
BLAKE2b-256 checksum
How to use checksums
a7d0e63037163a6673a06fc1156ba40450e2419292e79d50d36b209695111a21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page