Skip to main content

Pytql

Python Table Data Type with some SQL-like operations.

Authors

API Reference

Classes

  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

  draw_table(data)
Parameter Type Description
data List Required. Table data to be drawn

return: None

  add_row(data)
Parameter Type Description
row List Required. Row to be added to table
position Integer Position of the new row

return: None

  update(column)
Parameter Type Description
column String Required. Column to be updated

return: Table | None

  where(value, updated_value)
Parameter Type Description
value String Current value in table
updated_value String New value to replace old value

return: None

  query()

return: Data

  get_data()

return: List

Data Methods

  filter_by(column)
Parameter Type Description
column String Required. Column to be filtered

return: Data | None

  greater_than(value)
Parameter Type Description
value String Required. Value to be filtered by

return: Data | None

  less_than(value)
Parameter Type Description
value String Required. Value to be filtered by

return: Data | None

  equals(value)
Parameter Type Description
value String Required. Value to be filtered by

return: Data | None

  end_query()

return: List

Installation

Install pytql with pip3

  pip3 install pytql==[version]
  current version = 0.0.3

Usage/Examples

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)

Metadata

Release files for pytql 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytql 0.0.3
File Size Uploaded
pytql-0.0.3.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytql 0.0.3
File Interpreter ABI Platform
pytql-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / pytql-0.0.3.tar.gz

Download URL pytql-0.0.3.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9557413d8b46075b626462e81d760938c9f40295e2580405cb8ee3258848898d
BLAKE2b-256 checksum
How to use checksums
375bed0429688173d1652a4fb66ee2d4ce4762b1d2e4837f40b42f58888c1e49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / pytql-0.0.3-py3-none-any.whl

Download URL pytql-0.0.3-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2b97b60f36e03d1a75ca4bfb8ca1d564e8b3e725c369ac9c6cab179f3ebc00b
BLAKE2b-256 checksum
How to use checksums
1f1eacf7a3300d8c3d160489b789d80753cc18504fa369e4ff0ff9fd1e604aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page