A useful simple to use tool to turn your sql query into a beautiful report html table
Project description
This is easy to use tool for generating html table from sql query.
the package contains only one function named "generateFromSql" with 8 arguments :
- session : SQLAlchemy session
- title : the title of the report that will be shown on top of table
- sqltext : the sql query
- 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.
usage :
Installation
To install flask_sqlalchemy using pip type:
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'
return Reporter.generateFromSql(db.session, reportTitle, sqlQuery, columnsToBeSummarized,
"ltr", fontName, "Total Salary", True,
headerRowBackgroundColor, evenRowsBackgroundColor, oddRowsBackgroundColor
)
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
Built Distribution
Close
Hashes for flask_sqlalchemy_report-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 028debddc28973ae297a38a70b5a74add6a7ba3ca146a7fef706a043c6e73ecd |
|
MD5 | cdb6f9871d25bd6bdc43b4c3765b9235 |
|
BLAKE2b-256 | 7cecc343c49dde0f55a6437fda17af96e706d0da8a099ffd25545b302f2854a2 |
Close
Hashes for flask_sqlalchemy_report-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3737e18389def6962b70ef9974e850e93653d136ecadbb25ffe61eb3d4579b6e |
|
MD5 | e6fd1fec823b984e37540cb11bbd52ab |
|
BLAKE2b-256 | 16cfd29cfe31a868d211ab7d7687026ae3e8eaaa30c4b705d59a50f8536a9d47 |