sqliteObj.py
Synchronous SQLite access with dictionary filters, schema helpers, and text, CSV, and HTML export.
Setup and lifecycle
Place sqliteObj.py on the Python import path. Database operations use the standard-library sqlite3 package. Importing the module also imports pmblue_update and calls its self_update(); when absent, the bootstrap uses requests to download it over the legacy HTTP URL and writes pmblue_update.py in the working directory. Provision the updater before import when controlling deployment.
sqliteObj(filename, table=None) opens the connection immediately. Choose an existing default table with set_table(name), or supply table= to each operation. Call commit() to save data changes and close() when finished; close() does not commit pending changes.
Working example
This example initializes the schema with parameterized standard SQLite calls before constructing the wrapper, so its cached column lists start with the complete schema.
import sqlite3
import sqliteObj
with sqlite3.connect("contacts.db") as connection:
connection.execute(
"CREATE TABLE IF NOT EXISTS contacts "
"(id INTEGER PRIMARY KEY, name TEXT, city TEXT)"
)
db = sqliteObj.sqliteObj("contacts.db", table="contacts")
try:
contact_id = db.insert({"name": "Ada", "city": "London"})
db.commit()
rows = db.select({"id": contact_id})
print(rows[0]["name"])
changed = db.update({"city": "Oxford"}, {"id": contact_id})
db.commit()
print(changed)
finally:
db.close()
Query and return conventions
| Method | Behavior / return |
|---|---|
select_all(dict_mode=True, table=None, limit=None) | All matching rows as a list of dictionaries; dict_mode=False returns sqlite3.Row values. Without a default table, this method selects the first available table. |
select(select, orderDict=None, op_and=True, limit=None, case_insensitive=False, dict_mode=True, table=None) | A filter dictionary or a complete SQL query string. Returns a list even for one row; no match gives []. |
select_all_custom(key, ...), select_custom(key, select, ...) | Fetch rows, then retain rows for which the Python callback returns an actual boolean True. Other callback return types raise InvalidKeyResponse; SQL limits apply before callback filtering. |
insert(insert, table=None) | Accepts a dictionary or positional list; returns the last inserted row ID. None values are omitted so column defaults may apply. |
update(update, where, op_and=True, table=None) | Updates columns selected by a filter dictionary or raw condition; returns affected-row count. |
delete(delete, op_and=True, table=None) | Deletes rows matching the filter; returns affected-row count. |
cursor(), execute(query) | Return a native SQLite cursor. The wrapper's execute has no parameters argument; use db.cursor().execute(sql, values) for bound parameters. |
Dictionary filters support ordinary values and between(a, b), like(pattern), contains(text), case_insensitive(value), and is_not(value). List values produce an IN clause. op_and=False joins conditions with OR. Use one explicit ordering field, for example orderDict={"name": "ASC"}; the current multi-field builder overwrites earlier fields.
rows = db.select({"city": sqliteObj.contains("ford")}, limit=20)
rows = db.select({"name": sqliteObj.case_insensitive("ada")})
cursor = db.cursor()
cursor.execute("SELECT * FROM contacts WHERE name = ?", (submitted_name,))
rows = [dict(row) for row in cursor.fetchall()]
Schema and maintenance
tables() returns names; column_names(table=...) returns column names. create_table(name) creates an integer, autoincrementing id column. Add columns with add_column(name, datatype, current=None, table=None); types can be SQL strings or Integer, Real, Text, or TypeStr. current fills existing rows rather than defining a persistent SQL default. drop_table() removes a table. vacuum() commits and compacts; vacuum(to_file=...) requests a separate compacted database.
drop_column() is present but immediately raises an exception. Schema caches are not fully refreshed by every schema helper: reopening the wrapper after schema changes avoids stale col_names_exact lists, particularly with positional inserts or explicit table arguments.
Reports and export
to_txt(), to_csv(), and to_html() produce report text. to_txt_table() returns the included TxtTable object for further formatting. to_dict() returns a mapping of table names to row lists, including when one table is selected. flask_pagination(request, ...) provides Flask-oriented HTML pagination. TxtTable also supports columns, rows, text output, CSV, and HTML independently of a database.
Current limits and errors
This synchronous wrapper blocks the calling thread. Its internal queue does not change SQLite's connection thread restrictions. Most convenience queries interpolate values into SQL through custom escaping; use parameterized native cursors for arbitrary user text. Identifiers and raw SQL must come from trusted application code. Generated HTML is report markup and should not be assumed to escape arbitrary cell content.
Expect TableNotSet, ColumnNotFound, TableNotFound, or ModuleOperationError for supported validation paths; some methods still raise generic exceptions. ModuleOperationError includes the generated SQL and the underlying error text. The module-level exact setting controls its legacy quote-handling exception; it is not a substitute for bound SQL parameters.
For asynchronous applications, see aiosqliteObj. Its class names, schema types, and commit behavior differ.
Objects and connection state
The module contains three groups of objects: the sqliteObj connection wrapper, small SQL filter/type values, and TxtTable report objects. A SELECT returns row data rather than another database wrapper. Keep the connection alive while using its cursors; exported dictionaries and text no longer need the connection.
| Object / attribute | Meaning and use |
|---|---|
db.filename, db.conn | Original database filename and open native sqlite3.Connection. The connection gives access to standard parameterized execution and rollback. |
db.table | Default table name, or None. set_table("contacts") validates an existing name and returns it. Pass an explicit name: the no-argument branch returns the first name but does not consistently set the stored default. |
db.col_names, db.col_names_exact | Cached lowercase/exact column-name mappings created during construction. Treat them as metadata, not the schema-editing interface. |
db.total_changes | Counter maintained by the wrapper; raw native-cursor writes are not consistently included. Use the cursor's rowcount/lastrowid for a particular operation. |
Integer, Real, Text, TypeStr(sql_type) | Small SQL type descriptors exposing .type. Pass a descriptor instance or an SQL type string to add_column; these do not convert Python values. |
Filter values
Create filter values through the module namespace, for example sqliteObj.between(10, 20). They only store values until a query consumes them. between has value1/value2; the other filter classes have value. like("A%") supplies an SQL LIKE pattern, whereas contains("Ada") adds percent signs around the supplied text. case_insensitive requests SQLite NOCASE comparison. is_not negates a supported condition.
The select, update, and delete arguments are different roles: update(values, where) takes new column values first and a row filter second. A string passed as where is appended verbatim and must include its own WHERE keyword. By contrast, strings passed to select or delete are complete statements. An empty dictionary in delete({}), or where={}/None in update, targets every row.
Report objects
TxtTable(format_numbers=False, totals=False, len_limit=100) owns columns and rows lists. add_column(name, length=None, str_convert=None, value=None) returns a TxtTable.Column; add_row(*values) returns a TxtTable.Row whose data contains Cell objects. Supply one value per column. A column's str_convert changes display text while preserving the underlying cell value.
table.print(send=False) returns text without printing. With the default send=True, it prints and also returns that text. to_csv() and to_html() return strings; table_only=True asks HTML export for a table fragment. Column positions accepted by insert_column/remove_column are one-based.
Worked example: filter data and build a report
This complete example uses an in-memory database, parameterized setup, dictionary filtering, and a text report. Closing the database discards its data.
import sqliteObj as sql
db = sql.sqliteObj(":memory:")
try:
db.create_table("orders")
db.add_column("customer", "TEXT")
db.add_column("amount", "REAL")
cursor = db.cursor()
cursor.executemany(
"INSERT INTO orders (customer, amount) VALUES (?, ?)",
[("Ada", 120.0), ("Grace", 45.0), ("Linus", 80.0)],
)
db.commit()
rows = db.select({"amount": sql.between(50, 150)}, orderDict={"amount": "DESC"})
report = sql.TxtTable(format_numbers=True)
report.add_column("Customer")
report.add_column("Amount")
for row in rows:
report.add_row(row["customer"], row["amount"])
print(report.print(send=False))
print(db.to_dict()["orders"][0]["customer"])
finally:
db.close()
Worked example: explicit commit or rollback
The wrapper does not define a transaction context manager. Use its native connection for rollback and explicitly commit after a successful group of writes. This temporary database demonstrates failure without leaving a file behind.
import os
import sqlite3
import tempfile
import sqliteObj
with tempfile.TemporaryDirectory() as directory:
path = os.path.join(directory, "users.db")
with sqlite3.connect(path) as connection:
connection.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT UNIQUE)")
db = sqliteObj.sqliteObj(path, table="users")
try:
try:
cursor = db.cursor()
cursor.execute("INSERT INTO users (name) VALUES (?)", ("Ada",))
cursor.execute("INSERT INTO users (name) VALUES (?)", ("Ada",))
db.commit()
except sqlite3.IntegrityError:
db.conn.rollback()
print(db.select_all()) # []: neither insert persisted
finally:
db.close()
Complete source API
Generated from modules/sqliteObj.py; version 1.13.1. Includes public functions, classes, directly declared methods, properties, and Python protocol methods. Conditional APIs may require optional dependencies. Inherited members and dynamically assigned attributes are explained in the guide where relevant.
Signatures and docstrings are extracted without importing or running the module. A property or AsyncProperty decorator changes how a member is accessed; see its decorators and the guide.
Classes and objects
TableNotSetColumnNotFoundTableNotFoundInvalidKeyResponseModuleOperationErrorWhatTheFuckAreYouDoingIntegerRealTextTypeStrbetweenlikecontainscase_insensitiveis_notQueueQueueManagersqliteObjTxtTableTxtTable.ColumnTxtTable.RowTxtTable.Cell
Module functions
class TableNotSet(Exception)
Source line 29
Exception raised when a table is not set.
Construct: TableNotSet()
Declared functions, properties, and nested objects:
TableNotSet.__init__— method
TableNotSet.__init__(self)
Source line 31
No caller-supplied parameters are declared.
class ColumnNotFound(Exception)
Source line 33
Exception raised when a column provided is not found.
Construct: ColumnNotFound(given, table)
Declared functions, properties, and nested objects:
ColumnNotFound.__init__— method
ColumnNotFound.__init__(self, given, table)
Source line 35
| Parameter | Passing convention | Default / required |
|---|---|---|
given | positional or keyword | required |
table | positional or keyword | required |
class TableNotFound(Exception)
Source line 37
Exception raised when a table is not found.
Construct: TableNotFound(table)
Declared functions, properties, and nested objects:
TableNotFound.__init__— method
TableNotFound.__init__(self, table)
Source line 39
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | required |
class InvalidKeyResponse(Exception)
Source line 41
Exception raised when given key function gives invalid response in a custom method.
Construct: InvalidKeyResponse(given, key)
Declared functions, properties, and nested objects:
InvalidKeyResponse.__init__— method
InvalidKeyResponse.__init__(self, given, key)
Source line 43
| Parameter | Passing convention | Default / required |
|---|---|---|
given | positional or keyword | required |
key | positional or keyword | required |
class ModuleOperationError(Exception)
Source line 45
Exception raised when this module messes up essentially. When there is an error with an exection, the query that caused the error, and the exception itself, are returned.
Construct: ModuleOperationError(query, trc)
Declared functions, properties, and nested objects:
ModuleOperationError.__init__— method
ModuleOperationError.__init__(self, query, trc)
Source line 47
| Parameter | Passing convention | Default / required |
|---|---|---|
query | positional or keyword | required |
trc | positional or keyword | required |
class WhatTheFuckAreYouDoing(Exception)
Source line 49
Exception raised when you become a psychopath, and have both a pair of 2 single quotes, and a pair of 2 double quotes, in a string. Either do sqliteObj.exact = False, or just stop.
Construct: WhatTheFuckAreYouDoing()
Declared functions, properties, and nested objects:
WhatTheFuckAreYouDoing.__init__— method
WhatTheFuckAreYouDoing.__init__(self)
Source line 52
No caller-supplied parameters are declared.
sqltype(o)
Source line 59
| Parameter | Passing convention | Default / required |
|---|---|---|
o | positional or keyword | required |
itemStr(item)
Source line 63
| Parameter | Passing convention | Default / required |
|---|---|---|
item | positional or keyword | required |
class Integer
Source line 80
Construct: Integer()
Fields assigned by the constructor: type. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
Integer.__init__— method
Integer.__init__(self)
Source line 83
No caller-supplied parameters are declared.
class Real
Source line 86
Construct: Real()
Fields assigned by the constructor: type. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
Real.__init__— method
Real.__init__(self)
Source line 89
No caller-supplied parameters are declared.
class Text
Source line 92
Construct: Text()
Fields assigned by the constructor: type. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
Text.__init__— method
Text.__init__(self)
Source line 95
No caller-supplied parameters are declared.
class TypeStr
Source line 98
Construct: TypeStr(value)
Fields assigned by the constructor: type. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
TypeStr.__init__— method
TypeStr.__init__(self, value)
Source line 99
| Parameter | Passing convention | Default / required |
|---|---|---|
value | positional or keyword | required |
class between
Source line 102
Construct: between(value1, value2)
Fields assigned by the constructor: value1, value2. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
between.__init__— method
between.__init__(self, value1, value2)
Source line 103
| Parameter | Passing convention | Default / required |
|---|---|---|
value1 | positional or keyword | required |
value2 | positional or keyword | required |
class like
Source line 107
Construct: like(value)
Fields assigned by the constructor: value. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
like.__init__— method
like.__init__(self, value)
Source line 108
| Parameter | Passing convention | Default / required |
|---|---|---|
value | positional or keyword | required |
class contains
Source line 111
Construct: contains(value)
Fields assigned by the constructor: value. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
contains.__init__— method
contains.__init__(self, value)
Source line 112
| Parameter | Passing convention | Default / required |
|---|---|---|
value | positional or keyword | required |
class case_insensitive
Source line 115
Construct: case_insensitive(value)
Fields assigned by the constructor: value. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
case_insensitive.__init__— method
case_insensitive.__init__(self, value)
Source line 116
| Parameter | Passing convention | Default / required |
|---|---|---|
value | positional or keyword | required |
class is_not
Source line 119
Construct: is_not(value)
Fields assigned by the constructor: value. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
is_not.__init__— method
is_not.__init__(self, value)
Source line 120
| Parameter | Passing convention | Default / required |
|---|---|---|
value | positional or keyword | required |
class_name(c)
Source line 124
| Parameter | Passing convention | Default / required |
|---|---|---|
c | positional or keyword | required |
class Queue
Source line 135
Construct: Queue()
Fields assigned by the constructor: q. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
Queue.__init__— methodQueue.qm— method
Queue.__init__(self)
Source line 136
No caller-supplied parameters are declared.
Queue.qm(self)
Source line 138
No caller-supplied parameters are declared.
class QueueManager
Source line 140
Construct: QueueManager(q)
Fields assigned by the constructor: q. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
QueueManager.__init__— methodQueueManager.__enter__— methodQueueManager.__exit__— method
QueueManager.__init__(self, q)
Source line 141
| Parameter | Passing convention | Default / required |
|---|---|---|
q | positional or keyword | required |
QueueManager.__enter__(self)
Source line 143
No caller-supplied parameters are declared.
QueueManager.__exit__(self, *args)
Source line 157
| Parameter | Passing convention | Default / required |
|---|---|---|
args | extra positional arguments (*args) | optional collection |
class sqliteObj
Source line 160
Construct: sqliteObj(filename, table=None)
Fields assigned by the constructor: col_names, col_names_exact, conn, filename, table, total_changes. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
sqliteObj.__init__— methodsqliteObj.col_exists— methodsqliteObj.col_names_update— methodsqliteObj.select_all_custom— methodsqliteObj.select_custom— methodsqliteObj.select_all— methodsqliteObj.select— methodsqliteObj.set_table— methodsqliteObj.tables— methodsqliteObj.vacuum— methodsqliteObj.update— methodsqliteObj.insert— methodsqliteObj.column_names— methodsqliteObj.add_column— methodsqliteObj.drop_column— methodsqliteObj.create_table— methodsqliteObj.drop_table— methodsqliteObj.delete— methodsqliteObj.commit— methodsqliteObj.cursor— methodsqliteObj.execute— methodsqliteObj.close— methodsqliteObj.to_txt— methodsqliteObj.to_txt_table— methodsqliteObj.to_csv— methodsqliteObj.to_html— methodsqliteObj.to_dict— methodsqliteObj.flask_pagination— method
sqliteObj.__init__(self, filename, table=None)
Source line 161
| Parameter | Passing convention | Default / required |
|---|---|---|
filename | positional or keyword | required |
table | positional or keyword | None |
sqliteObj.col_exists(self, col_name, table)
Source line 185
| Parameter | Passing convention | Default / required |
|---|---|---|
col_name | positional or keyword | required |
table | positional or keyword | required |
sqliteObj.col_names_update(self)
Source line 190
No caller-supplied parameters are declared.
sqliteObj.select_all_custom(self, key, dict_mode=True, table=None, limit=None)
Source line 201
| Parameter | Passing convention | Default / required |
|---|---|---|
key | positional or keyword | required |
dict_mode | positional or keyword | True |
table | positional or keyword | None |
limit | positional or keyword | None |
sqliteObj.select_custom(self, key, select, orderDict=None, op_and=True, limit=None, case_insensitive=False, dict_mode=True, table=None)
Source line 257
| Parameter | Passing convention | Default / required |
|---|---|---|
key | positional or keyword | required |
select | positional or keyword | required |
orderDict | positional or keyword | None |
op_and | positional or keyword | True |
limit | positional or keyword | None |
case_insensitive | positional or keyword | False |
dict_mode | positional or keyword | True |
table | positional or keyword | None |
sqliteObj.select_all(self, dict_mode=True, table=None, limit=None)
Source line 405
| Parameter | Passing convention | Default / required |
|---|---|---|
dict_mode | positional or keyword | True |
table | positional or keyword | None |
limit | positional or keyword | None |
sqliteObj.select(self, select, orderDict=None, op_and=True, limit=None, case_insensitive=False, dict_mode=True, table=None)
Source line 449
| Parameter | Passing convention | Default / required |
|---|---|---|
select | positional or keyword | required |
orderDict | positional or keyword | None |
op_and | positional or keyword | True |
limit | positional or keyword | None |
case_insensitive | positional or keyword | False |
dict_mode | positional or keyword | True |
table | positional or keyword | None |
sqliteObj.set_table(self, table=None)
Source line 582
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
sqliteObj.tables(self)
Source line 612
No caller-supplied parameters are declared.
sqliteObj.vacuum(self, to_file=None)
Source line 632
Vacuums the database, making the file smaller. to_file - If set to the path to a new file, it will create a new, vacuumed version of this database seperate from the current database.
| Parameter | Passing convention | Default / required |
|---|---|---|
to_file | positional or keyword | None |
sqliteObj.update(self, update, where, op_and=True, table=None)
Source line 646
| Parameter | Passing convention | Default / required |
|---|---|---|
update | positional or keyword | required |
where | positional or keyword | required |
op_and | positional or keyword | True |
table | positional or keyword | None |
sqliteObj.insert(self, insert, table=None)
Source line 768
| Parameter | Passing convention | Default / required |
|---|---|---|
insert | positional or keyword | required |
table | positional or keyword | None |
sqliteObj.column_names(self, table=None)
Source line 857
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
sqliteObj.add_column(self, column, datatype, current=None, table=None)
Source line 889
| Parameter | Passing convention | Default / required |
|---|---|---|
column | positional or keyword | required |
datatype | positional or keyword | required |
current | positional or keyword | None |
table | positional or keyword | None |
sqliteObj.drop_column(self, column, table=None)
Source line 924
| Parameter | Passing convention | Default / required |
|---|---|---|
column | positional or keyword | required |
table | positional or keyword | None |
sqliteObj.create_table(self, table)
Source line 951
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | required |
sqliteObj.drop_table(self, table=None)
Source line 972
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
sqliteObj.delete(self, delete, op_and=True, table=None)
Source line 997
| Parameter | Passing convention | Default / required |
|---|---|---|
delete | positional or keyword | required |
op_and | positional or keyword | True |
table | positional or keyword | None |
sqliteObj.commit(self)
Source line 1099
No caller-supplied parameters are declared.
sqliteObj.cursor(self)
Source line 1102
No caller-supplied parameters are declared.
sqliteObj.execute(self, query)
Source line 1115
| Parameter | Passing convention | Default / required |
|---|---|---|
query | positional or keyword | required |
sqliteObj.close(self)
Source line 1121
No caller-supplied parameters are declared.
sqliteObj.to_txt(self, table=None, len_limit=30, limit=None)
Source line 1130
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
len_limit | positional or keyword | 30 |
limit | positional or keyword | None |
sqliteObj.to_txt_table(self, table=None, len_limit=100, limit=None, format_numbers=False)
Source line 1145
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
len_limit | positional or keyword | 100 |
limit | positional or keyword | None |
format_numbers | positional or keyword | False |
sqliteObj.to_csv(self, table=None)
Source line 1160
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
sqliteObj.to_html(self, table=None, max_len=100, condensed=True, row_range=None, to_body_top='', to_body_bottom='', to_head='', own_rows=None, table_only=False)
Source line 1200
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
max_len | positional or keyword | 100 |
condensed | positional or keyword | True |
row_range | positional or keyword | None |
to_body_top | positional or keyword | '' |
to_body_bottom | positional or keyword | '' |
to_head | positional or keyword | '' |
own_rows | positional or keyword | None |
table_only | positional or keyword | False |
sqliteObj.to_dict(self, table=None, dict_mode=True)
Source line 1350
| Parameter | Passing convention | Default / required |
|---|---|---|
table | positional or keyword | None |
dict_mode | positional or keyword | True |
sqliteObj.flask_pagination(self, request, per_page=50, max_len=100, table=None)
Source line 1378
| Parameter | Passing convention | Default / required |
|---|---|---|
request | positional or keyword | required |
per_page | positional or keyword | 50 |
max_len | positional or keyword | 100 |
table | positional or keyword | None |
class TxtTable
Source line 1467
Construct: TxtTable(format_numbers=False, totals=False, len_limit=100)
Fields assigned by the constructor: col_amt, columns, format_int, len_limit, row_amt, rows, totals. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
TxtTable.row— methodTxtTable.numbFormat— methodTxtTable.formattedToNumb— methodTxtTable.__init__— methodTxtTable.add_column— methodTxtTable.insert_column— methodTxtTable.add_row— methodTxtTable.remove_column— methodTxtTable.print— methodTxtTable.to_html— methodTxtTable.flask_pagination— methodTxtTable.to_csv— methodTxtTable.__repr__— methodTxtTable.Column— nested classTxtTable.Row— nested classTxtTable.Cell— nested classTxtTable.to_numb— method
TxtTable.row(txt, rl=8)
Source line 1468
| Parameter | Passing convention | Default / required |
|---|---|---|
txt | positional or keyword | required |
rl | positional or keyword | 8 |
TxtTable.numbFormat(number)
Source line 1478
| Parameter | Passing convention | Default / required |
|---|---|---|
number | positional or keyword | required |
TxtTable.formattedToNumb(number)
Source line 1487
| Parameter | Passing convention | Default / required |
|---|---|---|
number | positional or keyword | required |
TxtTable.__init__(self, format_numbers=False, totals=False, len_limit=100)
Source line 1489
| Parameter | Passing convention | Default / required |
|---|---|---|
format_numbers | positional or keyword | False |
totals | positional or keyword | False |
len_limit | positional or keyword | 100 |
TxtTable.add_column(self, name, length=None, str_convert=None, value=None)
Source line 1497
| Parameter | Passing convention | Default / required |
|---|---|---|
name | positional or keyword | required |
length | positional or keyword | None |
str_convert | positional or keyword | None |
value | positional or keyword | None |
TxtTable.insert_column(self, name, loc, length=None, str_convert=None, value=None)
Source line 1514
| Parameter | Passing convention | Default / required |
|---|---|---|
name | positional or keyword | required |
loc | positional or keyword | required |
length | positional or keyword | None |
str_convert | positional or keyword | None |
value | positional or keyword | None |
TxtTable.add_row(self, *args)
Source line 1541
| Parameter | Passing convention | Default / required |
|---|---|---|
args | extra positional arguments (*args) | optional collection |
TxtTable.remove_column(self, col_num)
Source line 1549
| Parameter | Passing convention | Default / required |
|---|---|---|
col_num | positional or keyword | required |
TxtTable.print(self, limit=None, send=True)
Source line 1560
| Parameter | Passing convention | Default / required |
|---|---|---|
limit | positional or keyword | None |
send | positional or keyword | True |
TxtTable.to_html(self, max_len=100, condensed=True, row_range=None, to_body_top='', to_body_bottom='', to_head='', own_rows=None, table_only=False, row_colors=[['#f0eceb', '#000000'], ['#e6e2e1', '#000000']], background_color='#f7f2f2', header_color='#000000')
Source line 1600
| Parameter | Passing convention | Default / required |
|---|---|---|
max_len | positional or keyword | 100 |
condensed | positional or keyword | True |
row_range | positional or keyword | None |
to_body_top | positional or keyword | '' |
to_body_bottom | positional or keyword | '' |
to_head | positional or keyword | '' |
own_rows | positional or keyword | None |
table_only | positional or keyword | False |
row_colors | positional or keyword | [['#f0eceb', '#000000'], ['#e6e2e1', '#000000']] |
background_color | positional or keyword | '#f7f2f2' |
header_color | positional or keyword | '#000000' |
TxtTable.flask_pagination(self, request, per_page=50, max_len=100, page_colors=['#ffffff', '#000000'], to_body_top='', querystring='', search_ignore=None, custom_sort={}, **kwargs)
Source line 1754
| Parameter | Passing convention | Default / required |
|---|---|---|
request | positional or keyword | required |
per_page | positional or keyword | 50 |
max_len | positional or keyword | 100 |
page_colors | positional or keyword | ['#ffffff', '#000000'] |
to_body_top | positional or keyword | '' |
querystring | positional or keyword | '' |
search_ignore | positional or keyword | None |
custom_sort | positional or keyword | {} |
kwargs | extra keyword arguments (**kwargs) | optional collection |
TxtTable.to_csv(self)
Source line 2115
No caller-supplied parameters are declared.
TxtTable.__repr__(self)
Source line 2150
No caller-supplied parameters are declared.
class TxtTable.Column
Source line 2153
Construct: TxtTable.Column(name, length, table, col_num, str_convert=None)
Fields assigned by the constructor: col_num, length, name, str_convert, table. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
TxtTable.Column.__init__— methodTxtTable.Column.__len__— methodTxtTable.Column.rows_len— methodTxtTable.Column.__repr__— methodTxtTable.Column.total— methodTxtTable.Column.is_numb— methodTxtTable.Column.is_datetime— methodTxtTable.Column.cells— method
TxtTable.Column.__init__(self, name, length, table, col_num, str_convert=None)
Source line 2154
| Parameter | Passing convention | Default / required |
|---|---|---|
name | positional or keyword | required |
length | positional or keyword | required |
table | positional or keyword | required |
col_num | positional or keyword | required |
str_convert | positional or keyword | None |
TxtTable.Column.__len__(self)
Source line 2160
No caller-supplied parameters are declared.
TxtTable.Column.rows_len(self, rows)
Source line 2177
| Parameter | Passing convention | Default / required |
|---|---|---|
rows | positional or keyword | required |
TxtTable.Column.__repr__(self)
Source line 2194
No caller-supplied parameters are declared.
TxtTable.Column.total(self)
Source line 2196
No caller-supplied parameters are declared.
TxtTable.Column.is_numb(self)
Source line 2219
No caller-supplied parameters are declared.
TxtTable.Column.is_datetime(self)
Source line 2225
No caller-supplied parameters are declared.
TxtTable.Column.cells(self)
Source line 2231
No caller-supplied parameters are declared.
class TxtTable.Row
Source line 2241
Construct: TxtTable.Row(row_number, format_numbs, table, *args)
Fields assigned by the constructor: data, format_numbs, row_num, table. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
TxtTable.Row.__init__— methodTxtTable.Row.remove_column— methodTxtTable.Row.__repr__— methodTxtTable.Row.__eq__— methodTxtTable.Row.__contains__— methodTxtTable.Row.__len__— methodTxtTable.Row.__iter__— methodTxtTable.Row.__next__— methodTxtTable.Row.__getitem__— method
TxtTable.Row.__init__(self, row_number, format_numbs, table, *args)
Source line 2242
| Parameter | Passing convention | Default / required |
|---|---|---|
row_number | positional or keyword | required |
format_numbs | positional or keyword | required |
table | positional or keyword | required |
args | extra positional arguments (*args) | optional collection |
TxtTable.Row.remove_column(self, col_num)
Source line 2256
| Parameter | Passing convention | Default / required |
|---|---|---|
col_num | positional or keyword | required |
TxtTable.Row.__repr__(self)
Source line 2266
No caller-supplied parameters are declared.
TxtTable.Row.__eq__(self, other)
Source line 2268
| Parameter | Passing convention | Default / required |
|---|---|---|
other | positional or keyword | required |
TxtTable.Row.__contains__(self, other)
Source line 2272
| Parameter | Passing convention | Default / required |
|---|---|---|
other | positional or keyword | required |
TxtTable.Row.__len__(self)
Source line 2274
No caller-supplied parameters are declared.
TxtTable.Row.__iter__(self)
Source line 2276
No caller-supplied parameters are declared.
TxtTable.Row.__next__(self)
Source line 2279
No caller-supplied parameters are declared.
TxtTable.Row.__getitem__(self, item)
Source line 2281
| Parameter | Passing convention | Default / required |
|---|---|---|
item | positional or keyword | required |
class TxtTable.Cell
Source line 2301
Construct: TxtTable.Cell(value, print_value, col_num, row_num, format_numbs)
Fields assigned by the constructor: col_num, format_numbs, print_value, row_num, type, value. Some assignments may be conditional; see the object guide for meaning and lifecycle.
Declared functions, properties, and nested objects:
TxtTable.Cell.__init__— methodTxtTable.Cell.__len__— methodTxtTable.Cell.__str__— methodTxtTable.Cell.__contains__— methodTxtTable.Cell.__eq__— methodTxtTable.Cell.__repr__— method
TxtTable.Cell.__init__(self, value, print_value, col_num, row_num, format_numbs)
Source line 2302
| Parameter | Passing convention | Default / required |
|---|---|---|
value | positional or keyword | required |
print_value | positional or keyword | required |
col_num | positional or keyword | required |
row_num | positional or keyword | required |
format_numbs | positional or keyword | required |
TxtTable.Cell.__len__(self)
Source line 2319
No caller-supplied parameters are declared.
TxtTable.Cell.__str__(self)
Source line 2321
No caller-supplied parameters are declared.
TxtTable.Cell.__contains__(self, other)
Source line 2327
| Parameter | Passing convention | Default / required |
|---|---|---|
other | positional or keyword | required |
TxtTable.Cell.__eq__(self, other)
Source line 2329
| Parameter | Passing convention | Default / required |
|---|---|---|
other | positional or keyword | required |
TxtTable.Cell.__repr__(self)
Source line 2331
No caller-supplied parameters are declared.
TxtTable.to_numb(s)
Source line 2336
| Parameter | Passing convention | Default / required |
|---|---|---|
s | positional or keyword | required |