Skip to main content

A useful simple to use tool to turn your sql query into a beautiful report html table

Project description

Downloads

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

Read more about flask_sqlalchemy_report here

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_sqlalchemy_report-0.2.4.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_sqlalchemy_report-0.2.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file flask_sqlalchemy_report-0.2.4.tar.gz.

File metadata

  • Download URL: flask_sqlalchemy_report-0.2.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flask_sqlalchemy_report-0.2.4.tar.gz
Algorithm Hash digest
SHA256 7ee17dbc15d849c897153b093f4929cf0ac2aacffa211de0f3c640aca606eff6
MD5 c3f556efc509894031ff65a57fe1c804
BLAKE2b-256 393d3f8bf6f0b7552475927d0cd127214935e5aa34c18edbfeee8d024f81b154

See more details on using hashes here.

File details

Details for the file flask_sqlalchemy_report-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_sqlalchemy_report-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eec7ae43d9659c6cd9f4ffb04f40cc502996a50ebe55f5a920319e07f707bf09
MD5 b16281a5eec2ea6890370fca7b993fe5
BLAKE2b-256 096205cd4e515056b90c256e396b007d5e67284c179f54016ac1c1a24fbbecce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page