Flask_SqlAlchemy_Report is an easy to use tool for generating html table from sql query.
The package contains single function named "generateFromSql" which accepts 11 arguments :
- session : SQLAlchemy session
- title : The title of the report that will be shown on top of table
- sqltext : The sql select query to retrieve data
- footerCols : A list of columns name that you want to have Sum of values on footer . Example : ['amount','price']
- direction (default = "ltr") : Indicates direction of the report page. "ltr"- Left to Right , "rtl" - Right to Left
- font (default = "Tahoma") : Font of title and table contents
- totalText (default = "Total") : Title of footer row that will be the put below the first column.
- rowIndex (default = False) : Indicates whether the table should have index column or not.
- headerRowColor (default = '#eeeeee') : The header (title) row background color.
- evenRowColor (default = '#ffffff') : The even rows background color.
- oddRowColor (default = '#ffffff') : The odd rows background color.
Installation
To install flask_sqlalchemy using pip :
pip install flask-sqlalchemy-report
Usage :
from flask_sqlalchemy_report import Reporter
@app.route('/listOfPersons', methods=['GET'])
def listOfPersons():
reportTitle = "Employee List"
sqlQuery = "SELECT FirstName as 'First Name', LastName as 'Last Name', phone as 'Phone Number', salary as 'Salary' FROM persons"
columnsToBeSummarized = ['Salary']
fontName = "Arial"
headerRowBackgroundColor = '#ffeeee'
evenRowsBackgroundColor = '#ffeeff'
oddRowsBackgroundColor = '#ffffff'
rowIndexVisibility = True
footerSummaryTitle = "Total Salary"
return Reporter.generateFromSql(db.session, reportTitle, sqlQuery, columnsToBeSummarized,
"ltr", fontName, footerSummaryTitle, rowIndexVisibility,
headerRowBackgroundColor, evenRowsBackgroundColor, oddRowsBackgroundColor
)
See More
Metadata
Release files for flask-sqlalchemy-report 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flask_sqlalchemy_report-0.2.4.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_sqlalchemy_report-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / flask_sqlalchemy_report-0.2.4.tar.gz
| Download URL | flask_sqlalchemy_report-0.2.4.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ee17dbc15d849c897153b093f4929cf0ac2aacffa211de0f3c640aca606eff6
|
|
BLAKE2b-256 checksum How to use checksums |
393d3f8bf6f0b7552475927d0cd127214935e5aa34c18edbfeee8d024f81b154
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / flask_sqlalchemy_report-0.2.4-py3-none-any.whl
| Download URL | flask_sqlalchemy_report-0.2.4-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eec7ae43d9659c6cd9f4ffb04f40cc502996a50ebe55f5a920319e07f707bf09
|
|
BLAKE2b-256 checksum How to use checksums |
096205cd4e515056b90c256e396b007d5e67284c179f54016ac1c1a24fbbecce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|