# Pytql
Python Table Data Type with some SQL-like operations.
## Authors
- [@AT_Khay (Richard Quaicoe)](https://github.com/Attakay78/)
# API Reference
## Classes
```Class
Table / Data
```
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `headers` | `List , Optional` | A collection of table headers |
| `data` | `List , Optional` | Data to be populated in the table |
| `header_color` | `Color , Optional` | Color for the header |
| `row_color` | `Color , Optional` | Color for the rows |
| `table_color` | `Color , Optional` | Color for the table design |
## Table Methods
```method
draw_table(data)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `data` | `List` | **Required**. Table data to be drawn |
**return**: None
```method
add_row(data)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `row` | `List` | **Required**. Row to be added to table |
| `position` | `Integer` | Position of the new row |
**return**: None
```method
update(column)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `column` | `String` | **Required**. Column to be updated |
**return**: Table | None
```method
where(value, updated_value)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `value` | `String` | Current value in table|
| `updated_value` | `String` | New value to replace old value|
**return**: None
```method
query()
```
**return**: Data
```method
get_data()
```
**return**: List
## Data Methods
```method
filter_by(column)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `column` | `String` | **Required**. Column to be filtered |
**return**: Data | None
```method
greater_than(value)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `value` | `String` | **Required**. Value to be filtered by |
**return**: Data | None
```method
less_than(value)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `value` | `String` | **Required**. Value to be filtered by |
**return**: Data | None
```method
equals(value)
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `value` | `String` | **Required**. Value to be filtered by |
**return**: Data | None
```method
end_query()
```
**return**: List
## Installation
Install pytql with pip3
```bash
pip3 install pytql==[version]
current version = 0.0.3
```
## Usage/Examples
```python
from pytql import Table, Color
if __name__ == '__main__':
headers = ['First Name', 'Last Name', 'Age', 'Count']
list_data = [
["Richard", "Quaicoe", 23, 243],
["Mike", "Kuam", 33, 123],
["Roynam", "Skim", 13, 56],
["Leon", "Santa", 29, 23],
["Geroge"]
]
dict_data = {
'First Name': ['Richard', 'Mike', 'Roynam', 'Leon', 'George'],
'Last Name': ['Quaicoe', 'Kuam', 'Skim', 'Santa'],
'Age': [23, 33, 13, 29],
'Count': [243, 123, 56, 23]
}
# Example with passing dictionary data
table = Table(data=dict_data, header_color=Color.cyan, row_color=Color.green, table_color=Color.blue)
# Example with passing list data
table1 = Table(headers=headers, data=list_data, header_color=Color.cyan, row_color=Color.green, table_color=Color.blue)
# You can use table (for dict type) or table1 (for list type)
t_data = table.get_data()
table.draw_table(t_data)
table.add_row(["Mamba", "Avatar", 32, 43], position=3)
table.draw_table(t_data)
t1 = table.query().filter_by("First Name").equals("Richard").filter_by("Count").greater_than("50").end_query()
table.draw_table(t1)
table.update("Age").where("32", "67")
table.draw_table(t_data)
t1 = table.query().filter_by("Age").greater_than("50").end_query()
table.draw_table(t1)
table.add_row(["Clean", "Quain", 32, 43], position=2)
table.draw_table(t_data)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Attakay78/Pytql",
"name": "pytql",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,table,sql,query,filter",
"author": "AT_Khay (Richard Quaicoe)",
"author_email": "<richardquaicoe78@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/37/5b/ed0429688173d1652a4fb66ee2d4ce4762b1d2e4837f40b42f58888c1e49/pytql-0.0.3.tar.gz",
"platform": null,
"description": "\n# Pytql\n\nPython Table Data Type with some SQL-like operations.\n\n\n## Authors\n\n- [@AT_Khay (Richard Quaicoe)](https://github.com/Attakay78/)\n\n\n# API Reference\n\n## Classes\n\n```Class\n Table / Data\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :------------------------- |\n| `headers` | `List , Optional` | A collection of table headers | \n| `data` | `List , Optional` | Data to be populated in the table |\n| `header_color` | `Color , Optional` | Color for the header |\n| `row_color` | `Color , Optional` | Color for the rows |\n| `table_color` | `Color , Optional` | Color for the table design |\n\n\n## Table Methods\n\n```method\n draw_table(data)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `data` | `List` | **Required**. Table data to be drawn |\n\n**return**: None\n\n\n```method\n add_row(data)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `row` | `List` | **Required**. Row to be added to table | \n| `position` | `Integer` | Position of the new row |\n\n**return**: None\n\n```method\n update(column)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `column` | `String` | **Required**. Column to be updated |\n\n**return**: Table | None\n\n\n```method\n where(value, updated_value)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `value` | `String` | Current value in table|\n| `updated_value` | `String` | New value to replace old value|\n\n**return**: None\n\n\n```method\n query()\n```\n**return**: Data\n\n\n```method\n get_data()\n```\n**return**: List\n\n\n\n## Data Methods\n\n```method\n filter_by(column)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `column` | `String` | **Required**. Column to be filtered |\n\n**return**: Data | None\n\n\n```method\n greater_than(value)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `value` | `String` | **Required**. Value to be filtered by |\n\n**return**: Data | None\n\n\n```method\n less_than(value)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `value` | `String` | **Required**. Value to be filtered by |\n\n**return**: Data | None\n\n\n```method\n equals(value)\n```\n\n| Parameter | Type | Description |\n| :-------- | :------- | :-------------------------------- |\n| `value` | `String` | **Required**. Value to be filtered by |\n\n**return**: Data | None\n\n\n```method\n end_query()\n```\n**return**: List\n## Installation\n\nInstall pytql with pip3\n\n```bash\n pip3 install pytql==[version]\n current version = 0.0.3\n```\n \n## Usage/Examples\n\n```python\nfrom pytql import Table, Color\n\nif __name__ == '__main__':\n headers = ['First Name', 'Last Name', 'Age', 'Count']\n\n list_data = [\n [\"Richard\", \"Quaicoe\", 23, 243],\n [\"Mike\", \"Kuam\", 33, 123],\n [\"Roynam\", \"Skim\", 13, 56],\n [\"Leon\", \"Santa\", 29, 23],\n [\"Geroge\"]\n ]\n\n dict_data = {\n 'First Name': ['Richard', 'Mike', 'Roynam', 'Leon', 'George'],\n 'Last Name': ['Quaicoe', 'Kuam', 'Skim', 'Santa'],\n 'Age': [23, 33, 13, 29],\n 'Count': [243, 123, 56, 23]\n }\n\n # Example with passing dictionary data\n table = Table(data=dict_data, header_color=Color.cyan, row_color=Color.green, table_color=Color.blue)\n\n # Example with passing list data\n table1 = Table(headers=headers, data=list_data, header_color=Color.cyan, row_color=Color.green, table_color=Color.blue)\n\n # You can use table (for dict type) or table1 (for list type)\n t_data = table.get_data()\n table.draw_table(t_data)\n\n table.add_row([\"Mamba\", \"Avatar\", 32, 43], position=3)\n table.draw_table(t_data)\n\n t1 = table.query().filter_by(\"First Name\").equals(\"Richard\").filter_by(\"Count\").greater_than(\"50\").end_query()\n table.draw_table(t1)\n\n table.update(\"Age\").where(\"32\", \"67\")\n table.draw_table(t_data)\n\n t1 = table.query().filter_by(\"Age\").greater_than(\"50\").end_query()\n table.draw_table(t1)\n\n table.add_row([\"Clean\", \"Quain\", 32, 43], position=2)\n table.draw_table(t_data)\n```\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Python Table Data Type with some SQL-like operations.",
"version": "0.0.3",
"split_keywords": [
"python",
"table",
"sql",
"query",
"filter"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "35543551ad8357fcb1f7a0f826ffd43b",
"sha256": "a2b97b60f36e03d1a75ca4bfb8ca1d564e8b3e725c369ac9c6cab179f3ebc00b"
},
"downloads": -1,
"filename": "pytql-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "35543551ad8357fcb1f7a0f826ffd43b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7030,
"upload_time": "2022-12-14T08:08:01",
"upload_time_iso_8601": "2022-12-14T08:08:01.082701Z",
"url": "https://files.pythonhosted.org/packages/1f/1e/acf7a3300d8c3d160489b789d80753cc18504fa369e4ff0ff9fd1e604aab/pytql-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "e01eca58c3eee4e7f7050f28767bf9f2",
"sha256": "9557413d8b46075b626462e81d760938c9f40295e2580405cb8ee3258848898d"
},
"downloads": -1,
"filename": "pytql-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "e01eca58c3eee4e7f7050f28767bf9f2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6945,
"upload_time": "2022-12-14T08:08:03",
"upload_time_iso_8601": "2022-12-14T08:08:03.673979Z",
"url": "https://files.pythonhosted.org/packages/37/5b/ed0429688173d1652a4fb66ee2d4ce4762b1d2e4837f40b42f58888c1e49/pytql-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-14 08:08:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Attakay78",
"github_project": "Pytql",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytql"
}