flask-sqlalchemy-report


Nameflask-sqlalchemy-report JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/birddevelper/Flask_SqlAlchemy_Report
SummaryA useful simple to use tool to turn your sql query into a beautiful report html table
upload_time2023-03-29 09:43:38
maintainer
docs_urlNone
authorM.Shaeri
requires_python
licenseGNU
keywords flask sqlalchemy report html table sql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Downloads](https://static.pepy.tech/personalized-badge/flask-sqlalchemy-report?period=total&units=international_system&left_color=black&right_color=green&left_text=Downloads)](https://pepy.tech/project/flask-sqlalchemy-report)

### 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 :

```shell
pip install flask-sqlalchemy-report
```

## Usage :


```python
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
                                  )
   
 ```

## See More 
[Read More ](https://m-shaeri.ir/blog/generate-html-table-from-sql-query-in-flask/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/birddevelper/Flask_SqlAlchemy_Report",
    "name": "flask-sqlalchemy-report",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Flask,sqlAlchemy,Report,HTML,Table,SQL",
    "author": "M.Shaeri",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/2d/c2/8c0a3d7ac65609bb366009f42db3c04c0a51614678d68b26614aa700162f/flask_sqlalchemy_report-0.2.3.tar.gz",
    "platform": null,
    "description": "[![Downloads](https://static.pepy.tech/personalized-badge/flask-sqlalchemy-report?period=total&units=international_system&left_color=black&right_color=green&left_text=Downloads)](https://pepy.tech/project/flask-sqlalchemy-report)\n\n### Flask_SqlAlchemy_Report is an easy to use tool for generating html table from sql query.\n\nThe package contains single function named \"generateFromSql\" which accepts 11 arguments :\n\n* session : SQLAlchemy session\n* title : The title of the report that will be shown on top of table\n* sqltext : The sql select query to retrieve data\n* footerCols : A list of columns name that you want to have Sum of values on footer . Example : ['amount','price']\n* direction (default = \"ltr\") : Indicates direction of the report page.  \"ltr\"- Left to Right , \"rtl\" -  Right to Left\n* font (default = \"Tahoma\") : Font of title and table contents\n* totalText (default = \"Total\") : Title of footer row that will be the put below the first column.\n* rowIndex (default = False) : Indicates whether the table should have index column or not.\n* headerRowColor (default = '#eeeeee') :  The header (title) row background color.\n* evenRowColor (default = '#ffffff') :  The even rows background color.\n* oddRowColor (default = '#ffffff') :  The odd rows background color.\n\n\n\n## Installation\nTo install flask_sqlalchemy using pip :\n\n```shell\npip install flask-sqlalchemy-report\n```\n\n## Usage :\n\n\n```python\nfrom flask_sqlalchemy_report import Reporter \n\n@app.route('/listOfPersons', methods=['GET'])\ndef listOfPersons():\n  reportTitle = \"Employee List\"\n  sqlQuery = \"SELECT FirstName as 'First Name', LastName as 'Last Name', phone as 'Phone Number', salary as 'Salary' FROM persons\"\n  columnsToBeSummarized = ['Salary']\n  fontName = \"Arial\"\n  headerRowBackgroundColor = '#ffeeee'\n  evenRowsBackgroundColor = '#ffeeff'\n  oddRowsBackgroundColor = '#ffffff'\n  return Reporter.generateFromSql(db.session, reportTitle, sqlQuery, columnsToBeSummarized, \n                                  \"ltr\", fontName, \"Total Salary\", True,\n                                  headerRowBackgroundColor, evenRowsBackgroundColor, oddRowsBackgroundColor\n                                  )\n   \n ```\n\n## See More \n[Read More ](https://m-shaeri.ir/blog/generate-html-table-from-sql-query-in-flask/)\n",
    "bugtrack_url": null,
    "license": "GNU",
    "summary": "A useful simple to use tool to turn your sql query into a beautiful report html table",
    "version": "0.2.3",
    "split_keywords": [
        "flask",
        "sqlalchemy",
        "report",
        "html",
        "table",
        "sql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22ca81c0826fc125ea1b579ba4f3cbdaa2267012624a774bc0062ddbf869347d",
                "md5": "3313d382fb20d40cf7217cb8e3635285",
                "sha256": "e105e81a8753783f0e7bfbbb69974141dab7d4aee74b00949be94a40efe6de07"
            },
            "downloads": -1,
            "filename": "flask_sqlalchemy_report-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3313d382fb20d40cf7217cb8e3635285",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4081,
            "upload_time": "2023-03-29T09:43:36",
            "upload_time_iso_8601": "2023-03-29T09:43:36.912526Z",
            "url": "https://files.pythonhosted.org/packages/22/ca/81c0826fc125ea1b579ba4f3cbdaa2267012624a774bc0062ddbf869347d/flask_sqlalchemy_report-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2dc28c0a3d7ac65609bb366009f42db3c04c0a51614678d68b26614aa700162f",
                "md5": "a4bdee7a2483f29fb93d0154efee5431",
                "sha256": "c8e2cb570d03888a301f1ef76c1f0d0937004a1e1d51fb37cc8d8ed47bb7a165"
            },
            "downloads": -1,
            "filename": "flask_sqlalchemy_report-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a4bdee7a2483f29fb93d0154efee5431",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3481,
            "upload_time": "2023-03-29T09:43:38",
            "upload_time_iso_8601": "2023-03-29T09:43:38.529513Z",
            "url": "https://files.pythonhosted.org/packages/2d/c2/8c0a3d7ac65609bb366009f42db3c04c0a51614678d68b26614aa700162f/flask_sqlalchemy_report-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-29 09:43:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "birddevelper",
    "github_project": "Flask_SqlAlchemy_Report",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flask-sqlalchemy-report"
}
        
Elapsed time: 0.05027s