API Reference (more pages to come)
DISCLAIMER: While pysimplesql works with and was inspired by the excellent
PySimpleGUI™ project, it has no affiliation.
Rapidly build and deploy database applications in Python pysimplesql binds
PySimpleGUI to various databases for rapid, effortless database application development. Makes a great replacement for MS Access or LibreOffice Base! Have the full power and language features of Python while having the power and control of managing your own codebase. pysimplesql not only allows for super simple automatic control (not one single line of SQL needs written to use pysimplesql), but also allows for very low level control for situations that warrant it.
NAMING CONVENTIONS USED THROUGHOUT THE SOURCE CODE
There is a lot of ambiguity with database terminology, as many terms are used interchangeably in some circumstances, but not in others. The Internet has post after post debating this topic. See one example here: https://dba.stackexchange.com/questions/65609/column-vs-field-have-i-been-using-these-terms-incorrectly # fmt: skip To avoid confusion in the source code, specific naming conventions will be used whenever possible.
Naming conventions can fall under 4 categories: - referencing the database (variables, functions, etc. that relate to the database) - referencing the DataSet (variables, functions, etc. that relate to the DataSet) - referencing pysimplesql - referencing PySimpleGUI
-
Database related: driver - a SQLDriver derived class t, table, tables - the database table name(s) r, row, rows - A group of related data in a table c, col, cols, column, columns - A set of values of a particular type q, query - An SQL query string domain - the data type of the data (INTEGER, TEXT, etc.)
-
DataSet related: r, row, rows, df - A row, or collection of rows from querying the database c, col, cols, column, columns - A set of values of a particular type Record - A collection of fields that make up a row field - the value found where a row intersects a column
-
pysimplesql related frm - a Form object dataset, datasets - a DataSet object, or collection of DataSet objects data_key - the key (name) of a dataset object
-
PySimpleGUI related win, window - A PySimpleGUI Window object element - a Window element element_key - a window element key
TFORM_ENCODE: int = 1
module-attribute
TODO
TFORM_DECODE: int = 0
module-attribute
TODO
PROMPT_MODE: int = 1
module-attribute
TODO
AUTOSAVE_MODE: int = 2
module-attribute
TODO
SAVE_FAIL: int = 1
module-attribute
Save failed due to callback or database error
SAVE_SUCCESS: int = 2
module-attribute
Save was successful
SAVE_NONE: int = 4
module-attribute
There was nothing to save
keygen = KeyGen(separator=':')
module-attribute
This is a global keygen instance for general purpose use.
See KeyGen for more info
ElementType
Bases: Enum
Types for automatic mapping.
EventType
Bases: Enum
Event Types.
FUNCTION = auto()
class-attribute
instance-attribute
Custom events (requires 'function')
PromptSaveReturn
Bases: Enum
prompt_save return enums.
PROCEED = auto()
class-attribute
instance-attribute
After prompt_save, proceeded to save
NONE = auto()
class-attribute
instance-attribute
Found no records changed
DISCARDED = auto()
class-attribute
instance-attribute
User declined to save
Boolean
Bases: Flag
Enumeration class providing a convenient way to differentiate when a function may return a 'truthy' or 'falsy' value, such as 1, "", or 0.
Used in value_changed
TRUE = True
class-attribute
instance-attribute
Represents the boolean value True.
FALSE = False
class-attribute
instance-attribute
Represents the boolean value False.
ValidateMode
Bases: Enum
Enumeration class representing different validation modes.
STRICT = 'strict'
class-attribute
instance-attribute
Strict prevents invalid values from being entered.
RELAXED = 'relaxed'
class-attribute
instance-attribute
Relaxed allows invalid input, but ensures validation occurs before saving to the database.
DISABLED = 'disabled'
class-attribute
instance-attribute
Validation is turned off, and no checks or restrictions are applied.
ValidateRule
Bases: Enum
Collection of enums used ValidateResponse.
REQUIRED = 'required'
class-attribute
instance-attribute
Required field. Either set as 'NOTNULL' in database, or later in ColumnClass
PYTHON_TYPE = 'python_type'
class-attribute
instance-attribute
After casting, value is still not correct python type.
PRECISION = 'precision'
class-attribute
instance-attribute
Value has too many numerical places
MIN_VALUE = 'min_value'
class-attribute
instance-attribute
Value less than set mininum value
MAX_VALUE = 'max_value'
class-attribute
instance-attribute
Value greater than set maximum value
MIN_LENGTH = 'min_length'
class-attribute
instance-attribute
Value's length is less than minimum length
MAX_LENGTH = 'max_length'
class-attribute
instance-attribute
Value's length is greater than than maximum length
CUSTOM = 'custom'
class-attribute
instance-attribute
Special enum to be used when returning a ValidateResponse in your own `custom_validate_fn'.
Example
import re
def is_valid_email(email):
valid_email = re.match(r".+\@.+\..+", email) is not None
if not valid_email:
return ss.ValidateResponse(
ss.ValidateRule.CUSTOM, email, " is not a valid email"
)
return ss.ValidateResponse()
ValidateResponse
dataclass
Represents the response returned by validate method.
Attributes:
Name | Type | Description |
---|---|---|
exception |
Union[ValidateRule, None]
|
Indicates validation failure, if any. None for valid responses. |
value |
str
|
The value that was being validated. |
rule |
str
|
The specific ValidateRule that caused the exception, if applicable. |
Example
How how to create a ok popup from an exception:
```python
response = frm[data_key].column_info[col].validate(value)
if response.exception:
msg = f"{ss.lang.dataset_save_validate_error_header}"
field = ss.lang.dataset_save_validate_error_field.format_map(
ss.LangFormat(field=col)
)
exception = ss.lang[response.exception].format_map(
ss.LangFormat(value=response.value, rule=response.rule)
)
msg += f"{field}{exception}"
frm.popup.ok(lang.dataset_save_validate_error_title, msg)
```
CellFormatFn
Collection of functions to pre-format values before populating sg.Table
values.
Each function must accept and return 1 value. Additional arguments can be filled in via a lambda.
Example
fn = lambda x: ss.CellFormatFn.decimal_places(x, 2)
frm[data_key].column_info[col].cell_format_fn = fn
bool_to_checkbox(val)
staticmethod
Converts a boolean value to a themepack.checkbox_true/false.
Source code in pysimplesql\pysimplesql.py
398 399 400 401 402 403 404 405 406 407 |
|
decimal_places(val, decimal_places)
staticmethod
Format the value to specified decimal places using the system locale.
Source code in pysimplesql\pysimplesql.py
409 410 411 412 413 414 415 |
|
TableRow(pk, *args, **kwargs)
Bases: list
Convenience class used by Tables to associate a primary key with a row of data.
Note: This is typically not used by the end user.
Source code in pysimplesql\pysimplesql.py
428 429 430 |
|
ElementRow(pk, val)
Convenience class used by listboxes and comboboxes to associate a primary key with a row of data.
Note: This is typically not used by the end user.
Source code in pysimplesql\pysimplesql.py
452 453 454 |
|
Relationship
dataclass
Information from Foreign-Keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
join_type |
str
|
The join type. I.e. "LEFT JOIN", "INNER JOIN", etc. |
required |
child_table |
str
|
The table name of the fk table |
required |
fk_column |
Union[str, int]
|
The child table's foreign key column |
required |
parent_table |
str
|
The table name of the parent table |
required |
pk_column |
Union[str, int]
|
The parent table's primary key column |
required |
update_cascade |
bool
|
True if the child's fk_column ON UPDATE rule is 'CASCADE' |
required |
delete_cascade |
bool
|
True if the child's fk_column ON DELETE rule is 'CASCADE' |
required |
driver |
Driver
|
A SQLDriver instance. |
required |
__str__()
Return a join clause when cast to a string.
Source code in pysimplesql\pysimplesql.py
517 518 519 |
|
RelationshipStore
dataclass
Bases: list
Used to track primary/foreign key relationships in the database.
See the following for more information: add_relationship and auto_add_relationships.
Note: This class is not typically used the end user
get_rels_for(table)
Return the relationships for the passed-in table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table to get relationships for |
required |
Returns:
Type | Description |
---|---|
List[Relationship]
|
A list of @Relationship objects |
Source code in pysimplesql\pysimplesql.py
534 535 536 537 538 539 540 541 542 543 |
|
get_update_cascade_tables(table)
Return a unique list of the relationships for this table that should requery with this table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table to get cascaded children for |
required |
Returns:
Type | Description |
---|---|
List[str]
|
A unique list of table names |
Source code in pysimplesql\pysimplesql.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|
get_delete_cascade_tables(table)
Return a unique list of the relationships for this table that should be deleted with this table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table to get cascaded children for |
required |
Returns:
Type | Description |
---|---|
List[str]
|
A unique list of table names |
Source code in pysimplesql\pysimplesql.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
|
get_parent(table)
Return the parent table for the passed-in table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table (str) to get relationships for |
required |
Returns:
Type | Description |
---|---|
Union[str, None]
|
The name of the Parent table, or None if there is none |
Source code in pysimplesql\pysimplesql.py
581 582 583 584 585 586 587 588 589 590 591 592 593 |
|
is_parent_virtual(table, frm)
Return True if current row of parent table is virtual.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table (str) to get relationships for |
required |
frm |
Form
|
Form reference |
required |
Returns:
Type | Description |
---|---|
Union[bool, None]
|
True if current row of parent table is virtual |
Source code in pysimplesql\pysimplesql.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
|
get_update_cascade_fk_column(table)
Return the cascade fk that filters for the passed-in table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table name of the child |
required |
Returns:
Type | Description |
---|---|
Union[str, None]
|
The name of the cascade-fk, or None |
Source code in pysimplesql\pysimplesql.py
613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
get_delete_cascade_fk_column(table)
Return the cascade fk that filters for the passed-in table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table name of the child |
required |
Returns:
Type | Description |
---|---|
Union[str, None]
|
The name of the cascade-fk, or None |
Source code in pysimplesql\pysimplesql.py
627 628 629 630 631 632 633 634 635 636 637 638 639 |
|
get_dependent_columns(frm_reference, table)
Returns a dictionary of the key and column names that use the description_column text of the given parent table in their ElementRow objects.
This method is used to determine which GUI field and selector elements to update when a new description_column value is saved. The returned dictionary contains the key as the key and the corresponding column name as the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frm_reference |
Form
|
A Form object representing the parent form. |
required |
table |
str
|
The name of the parent table. |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
A dictionary of |
Source code in pysimplesql\pysimplesql.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
|
ElementMap
dataclass
Map a PySimpleGUI element to a specific DataSet column.
This is what makes the GUI automatically update to the contents of the database. This happens automatically when a PySimpleGUI Window is bound to a Form by using the bind parameter of Form creation, or by executing auto_map_elements() as long as the Table.column naming convention is used, This method can be used to manually map any element to any DataSet column regardless of naming convention.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Element
|
A PySimpleGUI Element |
required |
dataset |
DataSet
|
A DataSet object |
required |
column |
str
|
The name of the column to bind to the element |
required |
where_column |
str
|
Used for key, value shorthand |
None
|
where_value |
str
|
Used for key, value shorthand |
None
|
Returns:
Type | Description |
---|---|
None |
CurrentRow
dataclass
has_backup: bool
property
Returns True if the current_row has a backup row, and False otherwise.
A pandas Series object is stored rows.attrs["row_backup"] before a 'CellEdit' or 'LiveUpdate' operation is initiated, so that it can be compared in records_changed and save_record or used to restore if changes are discarded during a prompt_save operations.
Returns:
Type | Description |
---|---|
bool
|
True if a backup row is present that matches, and False otherwise. |
pk: int
property
Get the primary key of the currently selected record.
Returns:
Type | Description |
---|---|
int
|
the primary key |
backup()
Creates a backup copy of the current row in rows.
Source code in pysimplesql\pysimplesql.py
762 763 764 765 766 |
|
restore_backup()
Restores the backup row to the current row in rows.
This method replaces the current row in the dataset with the backup row, if a backup row is present.
Source code in pysimplesql\pysimplesql.py
768 769 770 771 772 773 774 775 776 |
|
get()
Get the row for the currently selected record of this table.
Returns:
Type | Description |
---|---|
Union[Series, None]
|
A pandas Series object |
Source code in pysimplesql\pysimplesql.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 |
|
get_original()
Returns a copy of current row as it was fetched in a query from SQLDriver.
If a backup of the current row is present, this method returns a copy of that row. Otherwise, it returns a copy of the current row. Returns None if rows is empty.
Source code in pysimplesql\pysimplesql.py
794 795 796 797 798 799 800 801 802 803 804 805 806 |
|
get_value(column, default='')
Get the value for the supplied column in the current row.
You can also use indexing of the Form object to get the current value of a column I.e. frm[{DataSet}].[{column}].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The column you want to get the value from |
required |
default |
Union[str, int]
|
A value to return if the record is null |
''
|
Returns:
Type | Description |
---|---|
Union[str, int]
|
The value of the column requested |
Source code in pysimplesql\pysimplesql.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
|
set_value(column, value, write_event=False)
Set the value for the supplied column in the current row, making a backup if needed.
You can also use indexing of the Form object to set the current value of a column. I.e. frm[{DataSet}].[{column}] = 'New value'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The column you want to set the value for |
required |
value |
Union[str, int]
|
A value to set the current record's column to |
required |
write_event |
bool
|
(optional) If True, writes an event to PySimpleGui as [after_record_edit][pysimplesql.pysimplesql.after_record_edit]. |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 |
|
DataSet
dataclass
DataSet objects are used for an internal representation of database tables.
DataSet instances are added by the following Form methods: add_dataset, auto_add_datasets. A DataSet is synonymous for a SQL Table (though you can technically have multiple DataSet objects referencing the same table, with each DataSet object having its own sorting, where clause, etc.). Note: While users will interact with DataSet objects often in pysimplesql, they typically aren't created manually by the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_key |
InitVar[str]
|
required | |
frm_reference |
InitVar[Form]
|
This is a reference to the @ Form object, for convenience. Accessible via frm |
required |
table |
str
|
Name of the table |
required |
pk_column |
str
|
The name of the column containing the primary key for this table. |
required |
description_column |
str
|
The name of the column used for display to users (normally in a combobox or listbox). |
required |
query |
Optional[str]
|
You can optionally set an initial query here. If none is provided, it will default to "SELECT * FROM {table}" |
''
|
order_clause |
Optional[str]
|
The sort order of the returned query. If none is provided it will default to "ORDER BY {description_column} ASC" |
''
|
filtered |
bool
|
(optional) If True, the relationships will be considered and an appropriate WHERE clause will be generated. False will display all records in the table. |
True
|
prompt_save |
(optional) Default: Mode set in Form. Prompt to save changes when dirty records are present. There are two modes available, PROMPT_MODE to prompt to save when unsaved changes are present. AUTOSAVE_MODE to automatically save when unsaved changes are present. |
required | |
save_quiet |
bool
|
(optional) Default: Set in Form. True to skip info popup on save. Error popups will still be shown. |
None
|
duplicate_children |
bool
|
(optional) Default: Set in Form. If record has children, prompt user to choose to duplicate current record, or both. |
None
|
validate_mode |
ValidateMode
|
None
|
Attributes:
Name | Type | Description |
---|---|---|
key |
str
|
TODO |
description_column: str
instance-attribute
TODO
key: str = field_(init=False)
class-attribute
instance-attribute
Short for 'data_key'
frm: Form = field_(init=False)
class-attribute
instance-attribute
TODO
driver: Driver = field_(init=False)
class-attribute
instance-attribute
TODO
relationships: RelationshipStore = field_(init=False)
class-attribute
instance-attribute
TODO
rows: pd.DataFrame = field_(init=False)
class-attribute
instance-attribute
TODO
join_clause: str = field_(init=False)
class-attribute
instance-attribute
TODO
where_clause: str = field_(init=False)
class-attribute
instance-attribute
TODO
search_order: List[str] = field_(init=False)
class-attribute
instance-attribute
TODO
row_count: int
property
Returns the number of rows in the dataset. If the dataset is not a pandas DataFrame, returns 0.
Returns:
Type | Description |
---|---|
int
|
The number of rows in the dataset. |
__getitem__(column)
Retrieve the value of the specified column in the current row.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The key of the column to retrieve. |
required |
Returns:
Type | Description |
---|---|
Union[str, int]
|
The current value of the specified column. |
Source code in pysimplesql\pysimplesql.py
994 995 996 997 998 999 1000 1001 1002 1003 |
|
__setitem__(column, value)
Set the value of the specified column in the current row.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
The key of the column to set. |
required | |
value |
Union[str, int]
|
The value to set the column to. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
|
purge_form(frm, reset_keygen)
classmethod
Purge the tracked instances related to frm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frm |
Form
|
required | |
reset_keygen |
bool
|
Reset the keygen after purging? |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 |
|
set_prompt_save(mode)
Set the prompt to save action when navigating records.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode |
int
|
Use PROMPT_MODE to prompt to save when unsaved changes are present. AUTOSAVE_MODE to automatically save when unsaved changes are present. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
|
set_search_order(order)
Set the search order when using the search box.
This is a list of column names to be searched, in order
Parameters:
Name | Type | Description | Default |
---|---|---|---|
order |
List[str]
|
A list of column names to search |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
|
set_callback(callback, fctn)
Set DataSet callbacks. A runtime error will be thrown if the callback is not supported.
The following callbacks are supported
- before_save: called before a record is saved. The save will continue if the callback returns true, or the record will rollback if the callback returns false.
- after_save: called after a record is saved. The save will commit to the database if the callback returns true, else it will rollback the transaction
- before_update: Alias for before_save
- after_update: Alias for after_save
- before_delete: called before a record is deleted. The delete will move forward if the callback returns true, else the transaction will rollback
- after_delete: called after a record is deleted. The delete will commit to the database if the callback returns true, else it will rollback the transaction
- before_duplicate: called before a record is duplicate. The duplicate will move forward if the callback returns true, else the transaction will rollback
- after_duplicate: called after a record is duplicate. The duplicate will commit to the database if the callback returns true, else it will rollback the transaction
- before_search: called before searching. The search will continue if the callback returns True
- after_search: called after a search has been performed. The record change will undo if the callback returns False
- record_changed: called after a record has changed (previous,next, etc.)
- after_record_edit: called after the internal DataSet row is edited via a
sg.Table
cell-edit, or field live-update.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback |
str
|
The name of the callback, from the list above |
required |
fctn |
Callable[[Form, Window, key], bool]
|
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 |
|
set_transform(fn)
Set a transform on the data for this DataSet.
Here you can set custom a custom transform to both decode data from the database and encode data written to the database. This allows you to have dates stored as timestamps in the database yet work with a human-readable format in the GUI and within PySimpleSQL. This transform happens only while PySimpleSQL actually reads from or writes to the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Callable
|
A callable function to preform encode/decode. This function should take three arguments: query, row (which will be populated by a dictionary of the row data), and an encode parameter (1 to encode, 0 to decode - see constants TFORM_ENCODE and TFORM_DECODE). Note that this transform works on one row at a time. See the example 'journal_with_data_manipulation.py' for a usage example. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 |
|
set_query(query)
Set the query string for the DataSet.
This is more for advanced users. It defaults to "SELECT * FROM {table};" This can override the default
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The query string you would like to associate with the table |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 |
|
set_join_clause(clause)
Set the DataSet object's join string.
This is more for advanced users, as it will automatically generate from the database Relationships otherwise.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
clause |
str
|
The join clause, such as "LEFT JOIN That on This.pk=That.fk" |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 |
|
set_where_clause(clause)
Set the DataSet object's where clause.
This is ADDED TO the auto-generated where clause from Relationship data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
clause |
str
|
The where clause, such as "WHERE pkThis=100" |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 |
|
set_order_clause(clause)
Set the DataSet object's order clause.
This is more for advanced users, as it will automatically generate from the database Relationships otherwise.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
clause |
str
|
The order clause, such as "Order by name ASC" |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 |
|
update_column_info(column_info=None)
Generate column information for the DataSet object.
This may need done, for example, when a manual query using joins is used. This is more for advanced users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_info |
ColumnInfo
|
(optional) A ColumnInfo instance. Defaults to being generated by the SQLDriver. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 |
|
set_description_column(column)
Set the DataSet object's description column.
This is the column that will display in Listboxes, Comboboxes, Tables, etc. By default, this is initialized to either the 'description','name' or 'title' column, or the 2nd column of the table if none of those columns exist. This method allows you to specify a different column to use as the description for the record.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The name of the column to use |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 |
|
records_changed(column=None, recursive=True)
Checks if records have been changed.
This is done by comparing PySimpleGUI control values with the stored DataSet values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
Limit the changed records search to just the supplied column name |
None
|
recursive |
bool
|
True to check related DataSet instances |
True
|
Returns:
Type | Description |
---|---|
bool
|
True or False on whether changed records were found |
Source code in pysimplesql\pysimplesql.py
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 |
|
value_changed(column_name, old_value, new_value, is_checkbox)
Verifies if a new value is different from an old value and returns the cast value ready to be inserted into a database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_name |
str
|
The name of the column used in casting. |
required |
old_value |
The value to check against. |
required | |
new_value |
The value being checked. |
required | |
is_checkbox |
bool
|
Whether or not additional logic should be applied to handle checkboxes. |
required |
Returns:
Type | Description |
---|---|
Union[Any, Boolean]
|
The cast value ready to be inserted into a database if the new value is |
Union[Any, Boolean]
|
different from the old value. Returns FALSE otherwise. |
Source code in pysimplesql\pysimplesql.py
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 |
|
prompt_save(update_elements=True)
Prompts the user, asking if they want to save when changes are detected.
This is called when the current record is about to change.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update_elements |
bool
|
(optional) Passed to save_records() -> save_record_recursive() to update_elements. Additionally used to discard changes if user reply's 'No' to prompt. |
True
|
Returns:
Type | Description |
---|---|
Union[Type[PromptSaveReturn], SAVE_FAIL]
|
A prompt return value of one of the following: PROCEED, |
Union[Type[PromptSaveReturn], SAVE_FAIL]
|
Source code in pysimplesql\pysimplesql.py
1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
|
requery(select_first=True, filtered=True, update_elements=True, requery_dependents=True)
Requeries the table.
The DataSet object maintains an internal representation of the actual database table. The requery method will query the actual database and sync the DataSet object to it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
select_first |
bool
|
(optional) If True, the first record will be selected after the requery. |
True
|
filtered |
bool
|
(optional) If True, the relationships will be considered and an appropriate WHERE clause will be generated. If False all records in the table will be fetched. |
True
|
update_elements |
bool
|
(optional) Passed to first() to update_elements. Note that the select_first parameter must equal True to use this parameter. |
True
|
requery_dependents |
bool
|
(optional) passed to first() to requery_dependents. Note that the select_first parameter must = True to use this parameter. |
True
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 |
|
requery_dependents(child=False, update_elements=True)
Requery parent DataSet instances as defined by the relationships of the table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
child |
bool
|
(optional) If True, will requery self. Default False; used to skip requery when called by parent. |
False
|
update_elements |
bool
|
True
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 |
|
first(update_elements=True, requery_dependents=True, skip_prompt_save=False)
Move to the first record of the table.
Only one entry in the table is ever considered "Selected" This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 |
|
last(update_elements=True, requery_dependents=True, skip_prompt_save=False)
Move to the last record of the table.
Only one entry in the table is ever considered "Selected". This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 |
|
next(update_elements=True, requery_dependents=True, skip_prompt_save=False)
Move to the next record of the table.
Only one entry in the table is ever considered "Selected". This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
|
previous(update_elements=True, requery_dependents=True, skip_prompt_save=False)
Move to the previous record of the table.
Only one entry in the table is ever considered "Selected". This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 |
|
search(search_string, update_elements=True, requery_dependents=True, skip_prompt_save=False, display_message=None)
Move to the next record in the DataSet that contains [search_string][pysimplesql.pysimplesql.search_string].
Successive calls will search from the current position, and wrap around back to the beginning. The search order from set_search_order() will be used. If the search order is not set by the user, it will default to the description column (see set_description_column()). Only one entry in the table is ever considered "Selected" This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_string |
str
|
The search string to look for |
required |
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
display_message |
bool
|
Displays a message "Search Failed: ...", otherwise is silent on fail. |
None
|
Returns:
Type | Description |
---|---|
Union[SEARCH_FAILED, SEARCH_RETURNED, SEARCH_ABORTED]
|
One of the following search values: [SEARCH_FAILED][pysimplesql.pysimplesql.SEARCH_FAILED], [SEARCH_RETURNED][pysimplesql.pysimplesql.SEARCH_RETURNED], |
Union[SEARCH_FAILED, SEARCH_RETURNED, SEARCH_ABORTED]
|
[SEARCH_ABORTED][pysimplesql.pysimplesql.SEARCH_ABORTED]. |
Source code in pysimplesql\pysimplesql.py
1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 |
|
set_by_index(index, update_elements=True, requery_dependents=True, skip_prompt_save=False, omit_elements=None)
Move to the record of the table located at the specified index in DataSet.
Only one entry in the table is ever considered "Selected". This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the record to move to. |
required |
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
omit_elements |
List[str]
|
(optional) A list of elements to omit from updating |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 |
|
set_by_pk(pk, update_elements=True, requery_dependents=True, skip_prompt_save=False, omit_elements=None)
Move to the record with this primary key.
This is useful when modifying a record (such as renaming). The primary key can be stored, the record re-named, and then the current record selection updated regardless of the new sort order.
Only one entry in the table is ever considered "Selected". This is one of several functions that influences which record is currently selected. See first(), previous(), next(), last(), search(), set_by_pk(), set_by_index().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pk |
int
|
The record to move to containing the primary key |
required |
update_elements |
bool
|
(optional) Update the GUI elements after switching records. |
True
|
requery_dependents |
bool
|
(optional) Requery dependents after switching records |
True
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
omit_elements |
list[str]
|
(optional) A list of elements to omit from updating |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 |
|
get_keyed_value(value_column, key_column, key_value)
Return [value_column][pysimplesql.pysimplesql.value_column] wherekey_column
=[key_value][pysimplesql.pysimplesql.key_value].
Useful for datastores with key/value pairs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value_column |
str
|
The column to fetch the value from |
required |
key_column |
str
|
The column in which to search for the value |
required |
key_value |
Union[str, int]
|
The value to search for |
required |
Returns:
Type | Description |
---|---|
Union[str, int, None]
|
Returns the value found in [value_column][pysimplesql.pysimplesql.value_column] |
Source code in pysimplesql\pysimplesql.py
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 |
|
add_selector(element, data_key, where_column=None, where_value=None)
Use an element such as a listbox, combobox or a table as a selector item for this table.
Note: This is not typically used by the end user, as this is called from the selector() convenience function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Element
|
the PySimpleGUI element used as a selector element |
required |
data_key |
str
|
the DataSet item this selector will operate on |
required |
where_column |
str
|
(optional) |
None
|
where_value |
str
|
(optional) |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 |
|
insert_record(values=None, skip_prompt_save=False)
Insert a new record virtually in the DataSet object.
If values are passed, it will initially set those columns to the values (I.e. {'name': 'New Record', 'note': ''}), otherwise they will be fetched from the database if present.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
Dict[str, Union[str, int]]
|
column:value pairs |
None
|
skip_prompt_save |
bool
|
Skip prompting the user to save dirty records before the insert. |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 |
|
save_record(display_message=None, update_elements=True, validate_fields=None)
Save the currently selected record.
Saves any changes made via the GUI back to the database. The before_save and after_save [callbacks][pysimplesql.pysimplesql.DataSet.callbacks] will call your own functions for error checking if needed!.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
display_message |
bool
|
Displays a message "Updates saved successfully", otherwise is silent on success. |
None
|
update_elements |
bool
|
Update the GUI elements after saving |
True
|
validate_fields |
bool
|
Validate fields before saving to database. |
None
|
Returns:
Type | Description |
---|---|
int
|
SAVE_NONE, SAVE_FAIL or SAVE_SUCCESS masked with SHOW_MESSAGE |
Source code in pysimplesql\pysimplesql.py
2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 |
|
save_record_recursive(results, display_message=False, check_prompt_save=False, update_elements=True)
Recursively save changes, taking into account the relationships of the tables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results |
SaveResultsDict
|
Used in save_records to collect save_record returns. Pass an empty dict to get list of {table : result} |
required |
display_message |
bool
|
Passed to save_record. Displays a message that updates were saved successfully, otherwise is silent on success. |
False
|
check_prompt_save |
bool
|
Used when called from prompt_save. Updates elements without saving if individual [_prompt_save()][pysimplesql.pysimplesql.DataSet._prompt_save] is False. |
False
|
update_elements |
bool
|
Update GUI elements, additionally passed to dependents. |
True
|
Returns:
Type | Description |
---|---|
SaveResultsDict
|
dict of {table : results} |
Source code in pysimplesql\pysimplesql.py
2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 |
|
delete_record(cascade=True)
Delete the currently selected record.
The before_delete and after_delete callbacks are run during this process to give some control over the process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cascade |
bool
|
Delete child records (as defined by Relationships that were set up) before deleting this record. |
True
|
Returns:
Type | Description |
---|---|
None |
Source code in pysimplesql\pysimplesql.py
2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 |
|
duplicate_record(children=None, skip_prompt_save=False)
Duplicate the currently selected record.
The before_duplicate and after_duplicate callbacks are run during this process to give some control over the process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
children |
bool
|
Duplicate child records (as defined by Relationships that were set up) before duplicating this record. |
None
|
skip_prompt_save |
bool
|
(optional) True to skip prompting to save dirty records |
False
|
Returns:
Type | Description |
---|---|
Union[bool, None]
|
None |
Source code in pysimplesql\pysimplesql.py
2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 |
|
get_description_for_pk(pk)
Get the description from the DataSet on the matching pk.
Return the description from description_column for the row where the [pk_column][pysimplesql.pysimplesql.DataSet.pk_column] = [pk][pysimplesql.pysimplesql.pk].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pk |
int
|
The primary key from which to find the description for |
required |
Returns:
Type | Description |
---|---|
Union[str, int, None]
|
The value found in the description column, or None if nothing is found |
Source code in pysimplesql\pysimplesql.py
2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 |
|
pk_is_virtual(pk=None)
Check whether pk is virtual.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pk |
int
|
The pk to check. If None, the pk of the current row will be checked. |
None
|
Returns:
Type | Description |
---|---|
bool
|
True or False based on whether the row is virtual |
Source code in pysimplesql\pysimplesql.py
2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 |
|
purge_row_backup()
Deletes the backup row from the dataset.
This method sets the "row_backup" attribute of the dataset to None.
Source code in pysimplesql\pysimplesql.py
2738 2739 2740 2741 2742 2743 |
|
table_values(columns=None, mark_unsaved=False, apply_search_filter=False, apply_cell_format_fn=True)
Create a values list of [TableRows][pysimplesql.pysimplesql.TableRows]s for use in a PySimpleGUI Table element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
columns |
List[str]
|
A list of column names to create table values for. Defaults to getting them from the rows DataFrame. |
None
|
mark_unsaved |
bool
|
Place a marker next to virtual records, or records with unsaved changes. |
False
|
apply_search_filter |
bool
|
Filter rows to only those columns in search_order that contain [search_string][pysimplesql.pysimplesql.DataSet.search_string]. |
False
|
apply_cell_format_fn |
bool
|
If set, apply()
|
True
|
Returns:
Type | Description |
---|---|
List[TableRow]
|
A list of TableRows suitable for using with PySimpleGUI Table element |
List[TableRow]
|
values. |
Source code in pysimplesql\pysimplesql.py
2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 |
|
column_likely_in_selector(column)
Determines whether the given column is likely to be displayed in a selector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The name of the column to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the column is likely to be displayed, False otherwise. |
Source code in pysimplesql\pysimplesql.py
2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 |
|
combobox_values(column_name, insert_placeholder=True)
Returns the values to use in a sg.Combobox as a list of ElementRow objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_name |
str
|
The name of the table column for which to get the values. |
required |
insert_placeholder |
bool
|
If True, inserts [combo_placeholder][pysimplesql.pysimplesql.Languagepack.combo_placeholder] as first value. |
True
|
Returns:
Type | Description |
---|---|
Union[List[ElementRow], None]
|
A list of ElementRow objects representing the possible values for the |
Union[List[ElementRow], None]
|
combobox column, or None if no matching relationship is found. |
Source code in pysimplesql\pysimplesql.py
2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 |
|
get_related_table_for_column(column)
Get parent table name as it relates to this column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The column name to get related table information for |
required |
Returns:
Type | Description |
---|---|
str
|
The name of the related table, or the current table if none are found |
Source code in pysimplesql\pysimplesql.py
2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 |
|
map_fk_descriptions(rows, columns=None)
Maps foreign key descriptions to the specified columns in the given DataFrame.
Note
If passing in rows, please pass in a copy, eg:
frm[data_key].rows.copy()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows |
DataFrame
|
The DataFrame containing the data to be processed. |
required |
columns |
list[str]
|
(Optional) The list of column names to map foreign key descriptions to. If none are provided, all columns of the DataFrame will be searched for foreign-key relationships. |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
The processed DataFrame with foreign key descriptions mapped to the specified columns. |
Source code in pysimplesql\pysimplesql.py
2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 |
|
quick_editor(pk_update_funct=None, funct_param=None, skip_prompt_save=False, column_attributes=None)
The quick editor is a dynamic PySimpleGUI Window for quick editing of tables. This is very useful for putting a button next to a combobox or listbox so that the available values can be added/edited/deleted easily. Note: This is not typically used by the end user, as it can be configured from the field() convenience function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pk_update_funct |
Callable
|
(optional) A function to call to determine the pk to select by default when the quick editor loads. |
None
|
funct_param |
any
|
(optional) A parameter to pass to the 'pk_update_funct' |
None
|
skip_prompt_save |
bool
|
(Optional) True to skip prompting to save dirty records |
False
|
column_attributes |
dict
|
(Optional) Dictionary specifying column attributes for [column_info][pysimplesql.pysimplesql.DataSet.column_info]. The dictionary should be in the form {column_name: {attribute: value}}. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 |
|
add_simple_transform(transforms)
Merge a dictionary of transforms into the [_simple_transform][pysimplesql.pysimplesql.DataSet._simple_transform] dictionary.
Example
{'entry_date' : {
'decode' : lambda row,col: datetime.utcfromtimestamp(int(row[col])).strftime('%m/%d/%y'),
'encode' : lambda row,col: datetime.strptime(row[col], '%m/%d/%y').replace(tzinfo=timezone.utc).timestamp(),
}}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transforms |
SimpleTransformsDict
|
A dict of dicts containing either 'encode' or 'decode' along with a callable to do the transform. See example above |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 |
|
purge_virtual()
Purge virtual rows from the DataFrame.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 |
|
sort_by_column(column, table, reverse=False)
Sort the DataFrame by column. Using the mapped relationships of the database, foreign keys will automatically sort based on the parent table's description column, rather than the foreign key number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The name of the column to sort the DataFrame by |
required |
table |
str
|
The name of the table the column belongs to |
required |
reverse |
bool
|
Reverse the sort; False = ASC, True = DESC |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 |
|
sort_by_index(index, table, reverse=False)
Sort the self.rows DataFrame by column index Using the mapped relationships of the database, foreign keys will automatically sort based on the parent table's description column, rather than the foreign key number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the column to sort the DateFrame by |
required |
table |
str
|
The name of the table the column belongs to |
required |
reverse |
bool
|
Reverse the sort; False = ASC, True = DESC |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 |
|
store_sort_settings()
Store the current sort settingg. Sort settings are just the sort column and reverse setting. Sort order can be restored with load_sort_settings().
Returns:
Type | Description |
---|---|
list
|
A list containing the sort_column and the sort_reverse |
Source code in pysimplesql\pysimplesql.py
3265 3266 3267 3268 3269 3270 3271 3272 |
|
load_sort_settings(sort_settings)
Load a previously stored sort setting. Sort settings are just the sort columm and reverse setting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sort_settings |
list
|
A list as returned by store_sort_settings() |
required |
Source code in pysimplesql\pysimplesql.py
3274 3275 3276 3277 3278 3279 3280 3281 3282 |
|
sort_reset()
Reset the sort order to the original order as defined by the DataFram index.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3284 3285 3286 3287 3288 3289 3290 3291 |
|
sort(table, update_elements=True, sort_order=None)
Sort according to the internal sort_column and sort_reverse variables. This is a good way to re-sort without changing the sort_cycle.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table associated with this DataSet. Passed along to sort_by_column() |
required |
update_elements |
bool
|
Update associated selectors and navigation buttons, and table header sort marker. |
True
|
sort_order |
A SORT_* constant (SORT_NONE, SORT_ASC, SORT_DESC). Note that the update_elements parameter must = True to use |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 |
|
sort_cycle(column, table, update_elements=True)
Cycle between original sort order of the DataFrame, ASC by column, and DESC by column with each call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The column name to cycle the sort on |
required |
table |
str
|
The table that the column belongs to |
required |
update_elements |
bool
|
Passed to sort to update update associated selectors and navigation buttons, and table header sort marker. |
True
|
Returns:
Type | Description |
---|---|
int
|
A sort constant; SORT_NONE, SORT_ASC, or SORT_DESC |
Source code in pysimplesql\pysimplesql.py
3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 |
|
insert_row(row, idx=None)
Insert a new virtual row into the DataFrame. Virtual rows are ones that exist in memory, but not in the database. When a save action is performed, virtual rows will be added into the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
dict
|
A dict representation of a row of data |
required |
idx |
int
|
The index where the row should be inserted (default to last index) |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 |
|
validate_field(column_name, new_value, widget=None, display_message=False)
Validate the given field value for the specified column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_name |
str
|
The name of the column to validate the field against. |
required |
new_value |
Any
|
The new value to validate. |
required |
widget |
The widget associated with the field. (Optional) |
None
|
|
display_message |
bool
|
Flag to display validation messages. (Default: False) |
False
|
Returns:
Type | Description |
---|---|
bool
|
True if the field value is valid, False otherwise. |
Source code in pysimplesql\pysimplesql.py
3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 |
|
Form
dataclass
Form class.
Maintains an internal version of the actual database DataSet objects can be accessed by key, I.e. frm['data_key'].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
driver |
SQLDriver
|
Supported SQLDriver. See Sqlite(), Mysql(), Postgres() |
required |
bind_window |
InitVar[Window]
|
Bind this window to the Form |
None
|
parent |
Form
|
(optional)Parent Form to base dataset off of |
None
|
filter |
str
|
(optional) Only import elements with the same filter set. Typically set with field(), but can also be set manually as a dict with the key 'filter' set in the element's metadata |
None
|
select_first |
InitVar[bool]
|
(optional) Default:True. For each top-level parent, selects first row, populating children as well. |
True
|
prompt_save |
(optional) Default:PROMPT_MODE. Prompt to save changes when dirty records are present. There are two modes available, PROMPT_MODE to prompt to save when unsaved changes are present. AUTOSAVE_MODE to automatically save when unsaved changes are present. |
required | |
save_quiet |
bool
|
(optional) Default:False. True to skip info popup on save. Error popups will still be shown. |
False
|
duplicate_children |
bool
|
(optional) Default:True. If record has children, prompt user to choose to duplicate current record, or both. |
True
|
description_column_names |
List[str]
|
(optional) A list of names to use for the DataSet object's description column, displayed in Listboxes, Comboboxes, and Tables instead of the primary key. The first matching column of the table is given priority. If no match is found, the second column is used. Default list: ['description', 'name', 'title']. |
field(default_factory=lambda : ['description', 'name', 'title'])
|
live_update |
bool
|
(optional) Default value is False. If True, changes made in a field will be immediately pushed to associated selectors. If False, changes will be pushed only after a save action. |
False
|
validate_mode |
ValidateMode
|
RELAXED
|
Returns:
Type | Description |
---|---|
None |
close(reset_keygen=True, close_driver=True)
Safely close out the Form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reset_keygen |
bool
|
True to reset the keygen for this Form |
True
|
close_driver |
bool
|
True to also close associated [driver][pysimplesql.pysimplesql.Form.driver] |
True
|
Source code in pysimplesql\pysimplesql.py
3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 |
|
bind(win)
Bind the PySimpleGUI Window to the Form for the purpose of GUI element, event and relationship mapping. This can happen automatically on Form creation with the bind parameter and is not typically called by the end user. This function literally just groups all the auto_* methods. auto_map_elements(), auto_map_events().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
win |
Window
|
The PySimpleGUI window |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 |
|
execute(query)
Execute a query.
Convenience function to pass along to execute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The query to execute |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
A pandas DataFrame object with attrs set for lastrowid and exception |
Source code in pysimplesql\pysimplesql.py
3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 |
|
commit()
Commit a transaction.
Convenience function to pass along to commit().
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3603 3604 3605 3606 3607 3608 3609 3610 3611 |
|
set_callback(callback_name, fctn)
Set Form callbacks.
A runtime error will be raised if the callback is not supported. The following callbacks are supported: update_elements Called after elements are updated via update_elements(). This allows for other GUI manipulation on each update of the GUI edit_enable Called before editing mode is enabled. This can be useful for asking for a password for example edit_disable Called after the editing mode is disabled.
{element_name} Called while updating MAPPED element. This overrides the default element update implementation. Note that the {element_name} callback function needs to return a value to pass to Win[element].update()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_name |
str
|
The name of the callback, from the list above |
required |
fctn |
Callable[[Form, Window], Union[None, bool]]
|
The function to call. Note, the function must take in two parameters, a Form instance, and a PySimpleGUI.Window instance |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 |
|
add_dataset(data_key, table, pk_column, description_column, query='', order_clause='')
Manually add a DataSet object to the Form When you attach to a database, PySimpleSQL isn't aware of what it contains until this command is run Note that auto_add_datasets() does this automatically, which is called when a Form is created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_key |
str
|
The key to give this DataSet. Use frm['data_key'] to access it. |
required |
table |
str
|
The name of the table in the database |
required |
pk_column |
str
|
The primary key column of the table in the database |
required |
description_column |
str
|
The column to be used to display to users in listboxes, comboboxes, etc. |
required |
query |
str
|
The initial query for the table. Auto generates "SELECT * FROM {table}" if none is passed |
''
|
order_clause |
str
|
The initial sort order for the query |
''
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 |
|
set_fk_column_cascade(child_table, fk_column, update_cascade=None, delete_cascade=None)
Set a foreign key's update_cascade and delete_cascade behavior.
auto_add_relationships() does this automatically from the database schema.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
child_table |
str
|
Child table with the foreign key. |
required |
fk_column |
str
|
Foreign key column of the child table. |
required |
update_cascade |
bool
|
True to requery and filter child table on selected parent primary key. |
None
|
delete_cascade |
bool
|
True to delete dependent child records if parent record is deleted. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 |
|
auto_add_datasets()
Automatically add DataSet objects from the database.
Works by looping through the tables available and creating a DataSet object for each. Each dataset key by default name of the table.
This is called automatically when a Form
is created. Note that
add_dataset() can do this manually on a per-table basis.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 |
|
map_element(element, dataset, column, where_column=None, where_value=None)
Map a PySimpleGUI element to a specific DataSet column. This is what makes the GUI automatically update to the contents of the database. This happens automatically when a PySimpleGUI Window is bound to a Form by using the bind parameter of Form creation, or by executing auto_map_elements() as long as the element metadata is configured properly. This method can be used to manually map any element to any DataSet column regardless of metadata configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Element
|
A PySimpleGUI Element |
required |
dataset |
DataSet
|
A DataSet object |
required |
column |
str
|
The name of the column to bind to the element |
required |
where_column |
str
|
Used for ke, value shorthand TODO: expand on this |
None
|
where_value |
str
|
Used for ey, value shorthand TODO: expand on this |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 |
|
add_info_element(element)
Add an element to be updated with info messages.
Must be either
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Union[StatusBar, Text]
|
A PySimpleGUI Element |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 |
|
auto_map_elements(win, keys=None)
Automatically map PySimpleGUI Elements to DataSet columns. A special naming convention has to be used for automatic mapping to happen. Note that map_element() can be used to manually map an Element to a column. Automatic mapping relies on a special naming convention as well as certain data in the Element's metadata. The convenience functions field(), selector(), and actions() do this automatically and should be used in almost all cases to make elements that conform to this standard, but this information will allow you to do this manually if needed. For individual fields, Element keys must be named 'Table.column'. Additionally, the metadata must contain a dict with the key of 'type' set to [FIELD][pysimplesql.pysimplesql.ElementType.FIELD]. For selectors, the key can be named whatever you want, but the metadata must contain a dict with the key of 'type' set to [SELECTOR][pysimplesql.pysimplesql.ElementType.SELECTOR].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
win |
Window
|
A PySimpleGUI Window |
required |
keys |
List[str]
|
(optional) Limit the auto mapping to this list of Element keys |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 |
|
set_element_clauses(element, where_clause=None, order_clause=None)
Set the where and/or order clauses for the specified element in the element map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Element
|
A PySimpleGUI Element |
required |
where_clause |
str
|
(optional) The where clause to set |
None
|
order_clause |
str
|
(optional) The order clause to set |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 |
|
map_event(event, fctn, table=None)
Manually map a PySimpleGUI event (returned by Window.read()) to a callable. The callable will execute when the event is detected by process_events(). Most users will not have to manually map any events, as auto_map_events() will create most needed events when a PySimpleGUI Window is bound to a Form by using the bind parameter of Form creation, or by executing auto_map_elements().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
str
|
The event to watch for, as returned by PySimpleGUI Window.read() (an element name for example) |
required |
fctn |
Callable[[None], None]
|
The callable to run when the event is detected. It should take no parameters and have no return value |
required |
table |
str
|
(optional) currently not used |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 |
|
replace_event(event, fctn, table=None)
Replace an event that was manually mapped with auto_map_events() or map_event(). The callable will execute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
str
|
The event to watch for, as returned by PySimpleGUI Window.read() (an element name for example) |
required |
fctn |
Callable[[None], None]
|
The callable to run when the event is detected. It should take no parameters and have no return value |
required |
table |
str
|
(optional) currently not used |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 |
|
auto_map_events(win)
Automatically map events. pysimplesql relies on certain events to function properly. This method maps all the record navigation (previous, next, etc.) and database actions (insert, delete, save, etc.). Note that the event mapper is very general-purpose, and you can add your own event triggers to the mapper using map_event(), or even replace one of the auto-generated ones if you have specific needs by using replace_event().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
win |
Window
|
A PySimpleGUI Window |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 |
|
edit_protect()
The edit protect system allows records to be protected from accidental editing by disabling the insert, delete, duplicate and save buttons on the GUI. A button to toggle the edit protect mode can easily be added by using the actions() convenience function.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 |
|
get_edit_protect()
Get the current edit protect state.
Returns:
Type | Description |
---|---|
bool
|
True if edit protect is enabled, False if not enabled |
Source code in pysimplesql\pysimplesql.py
4151 4152 4153 4154 4155 4156 4157 |
|
prompt_save()
Prompt to save if any GUI changes are found the affect any table on this form. The helps prevent data entry loss when performing an action that changes the current record of a DataSet.
Returns:
Type | Description |
---|---|
Type[PromptSaveReturn]
|
One of the prompt constant values: PromptSaveReturn.PROCEED, |
Type[PromptSaveReturn]
|
PromptSaveReturn.DISCARDED, PromptSaveReturn.NONE |
Source code in pysimplesql\pysimplesql.py
4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 |
|
set_prompt_save(mode)
Set the prompt to save action when navigating records for all DataSet objects associated with this Form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode |
int
|
Use PROMPT_MODE to prompt to save when unsaved changes are present. AUTOSAVE_MODE to autosave when unsaved changes are present. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 |
|
set_force_save(force=False)
Force save without checking for changes first, so even an unchanged record will be written back to the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
force |
bool
|
True to force unchanged records to save. |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 |
|
set_live_update(enable)
Toggle the immediate sync of field elements with other elements in Form.
When live-update is enabled, changes in a field element are immediately reflected in other elements in the same Form. This is achieved by binding the Window to watch for events that may trigger updates, such as mouse clicks, key presses, or selection changes in a combo box.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enable |
bool
|
If True, changes in a field element are immediately reflected in other elements in the same Form. If False, live-update is disabled. |
required |
Source code in pysimplesql\pysimplesql.py
4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 |
|
save_records(table=None, cascade_only=False, check_prompt_save=False, update_elements=True)
Save records of all DataSet objects` associated with this Form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
Name of table to save, as well as any cascaded relationships. Used in prompt_save() |
None
|
cascade_only |
bool
|
Save only tables with cascaded relationships. Default False. |
False
|
check_prompt_save |
bool
|
Passed to save_record_recursive to check if individual DataSet has prompt_save enabled. Used when save_records() is called from prompt_save(). |
False
|
update_elements |
bool
|
(optional) Passed to [save_record_recursive()][pysimplesql.pysimplesql.Form.save_record_recursive] |
True
|
Returns:
Type | Description |
---|---|
Union[SAVE_SUCCESS, SAVE_FAIL, SAVE_NONE]
|
result - can be used with RETURN BITMASKS |
Source code in pysimplesql\pysimplesql.py
4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 |
|
update_elements(target_data_key=None, edit_protect_only=False, omit_elements=None)
Updated the GUI elements to reflect values from the database for this Form instance only. Not to be confused with the main update_elements(), which updates GUI elements for all Form instances. This method also executes [update_selectors()][pysimplesql.pysimplesql.update_selectors], which updates selector elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_data_key |
str
|
(optional) dataset key to update elements for, otherwise updates elements for all datasets |
None
|
edit_protect_only |
bool
|
(optional) If true, only update items affected by edit_protect |
False
|
omit_elements |
List[str]
|
A list of elements to omit updating |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 |
|
update_actions(target_data_key=None)
Update state for action-buttons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_data_key |
str
|
(optional) dataset key to update elements for, otherwise updates elements for all datasets |
None
|
Source code in pysimplesql\pysimplesql.py
4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 |
|
update_fields(target_data_key=None, omit_elements=None, columns=None, combo_values_only=False)
Updated the field elements to reflect their [rows][pysimplesql.pysimplesql.rows] DataFrame for this Form instance only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_data_key |
str
|
(optional) dataset key to update elements for, otherwise updates elements for all datasets |
None
|
omit_elements |
List[str]
|
A list of elements to omit updating |
None
|
columns |
List[str]
|
A list of column names to update |
None
|
combo_values_only |
bool
|
Updates the value list only for comboboxes. |
False
|
Source code in pysimplesql\pysimplesql.py
4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 |
|
update_selectors(target_data_key=None, omit_elements=None, search_filter_only=False)
Updated the selector elements to reflect their [rows][pysimplesql.pysimplesql.rows] DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_data_key |
str
|
(optional) dataset key to update elements for, otherwise updates elements for all datasets. |
None
|
omit_elements |
List[str]
|
A list of elements to omit updating |
None
|
search_filter_only |
bool
|
Only update Table elements that have enabled apply_search_filter. |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 |
|
requery_all(select_first=True, filtered=True, update_elements=True, requery_dependents=True)
Requeries all DataSet objects associated with this Form. This effectively re-loads the data from the database into DataSet objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
select_first |
bool
|
True
|
|
filtered |
bool
|
passed to requery(). If True, the relationships will be considered and an appropriate WHERE clause will be generated. False will display all records from the table. |
True
|
update_elements |
bool
|
passed to requery() -> first() to update_elements(). Note that the select_first parameter must = True to use this parameter. |
True
|
requery_dependents |
bool
|
True
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 |
|
process_events(event, values)
Process mapped events for this specific Form instance.
Not to be confused with the main process_events(), which processes events for ALL Form instances. This should be called once per iteration in your event loop. Note: Events handled are responsible for requerying and updating elements as needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
str
|
The event returned by PySimpleGUI.read() |
required |
values |
list
|
the values returned by PySimpleGUI.read() |
required |
Returns:
Type | Description |
---|---|
bool
|
True if an event was handled, False otherwise |
Source code in pysimplesql\pysimplesql.py
4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 |
|
update_element_states(table, disable=None, visible=None)
Disable/enable and/or show/hide all elements associated with a table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
table name associated with elements to disable/enable |
required |
disable |
bool
|
True/False to disable/enable element(s), None for no change |
None
|
visible |
bool
|
True/False to make elements visible or not, None for no change |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 |
|
purge_instance(frm)
classmethod
Remove self from Form.instances.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frm |
Form
|
the Form to purge |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 |
|
Utility
Utility functions are a collection of functions and classes that directly improve on aspects of the pysimplesql module.
See the documentation for the following utility functions: process_events(), update_elements(), bind(), simple_transform(), KeyGen(),
Note: This is a dummy class that exists purely to enhance documentation and has no use to the end user.
Popup(window=None)
Popup helper class.
Has popup functions for internal use. Stores last info popup as last_info
Source code in pysimplesql\pysimplesql.py
5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 |
|
ok(title, msg)
Internal use only.
Creates sg.Window with LanguagePack OK button
Source code in pysimplesql\pysimplesql.py
5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 |
|
yes_no(title, msg)
Internal use only.
Creates sg.Window with LanguagePack Yes/No button
Source code in pysimplesql\pysimplesql.py
5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 |
|
info(msg, display_message=True, auto_close_seconds=None)
Displays a popup message and saves the message to self.last_info, auto- closing after x seconds. The title of the popup window is defined in lang.info_popup_title.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg |
str
|
The message to display. |
required |
display_message |
bool
|
(optional) If True (default), displays the message in the popup window. If False, only saves [msg][pysimplesql.pysimplesql.msg] to [last_info_msg][pysimplesql.pysimplesql.self.last_info_msg]. |
True
|
auto_close_seconds |
int
|
(optional) The number of seconds before the popup window auto-closes. If not provided, it is obtained from themepack.popup_info_auto_close_seconds. |
None
|
Source code in pysimplesql\pysimplesql.py
5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 |
|
update_info_element(message=None, auto_erase_seconds=None, timeout=False, erase=False)
Update any mapped info elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Text message to update info elements with |
None
|
auto_erase_seconds |
int
|
The number of seconds before automatically erasing the information element. If None, the default value from themepack will be used. |
None
|
timeout |
bool
|
A boolean flag indicating whether to erase the information element. If True, and the elapsed time since the information element was last updated exceeds the auto_erase_seconds, the element will be cleared. |
False
|
erase |
bool
|
Default False. Erase info elements |
False
|
Source code in pysimplesql\pysimplesql.py
5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 |
|
ProgressBar(title, max_value=100, hide_delay=100)
The progress bar is updated by calling the update method to update the progress in incremental steps until the close method is called
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
Title of the window |
required |
max_value |
int
|
Maximum value of the progress bar |
100
|
hide_delay |
int
|
Delay in milliseconds before displaying the Window |
100
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 |
|
update(message, current_count)
Updates the progress bar with the current progress message and value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Message to display |
required |
current_count |
int
|
Current value of the progress bar |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 |
|
close()
Closes the progress bar window.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5322 5323 5324 5325 5326 5327 5328 5329 |
|
ProgressAnimate(title, config=None)
The progress bar will animate indefinitely, until the process passed in to the run method finishes.
The config for the animated progress bar contains oscillators for the bar divider and colors, a list of phrases to be displayed, and the number of seconds to elapse between phrases. This is all specified in the config dict as follows: my_oscillators = { # oscillators for the bar divider and colors "bar": {"value_start": 0, "value_range": 100, "period": 3, "offset": 0}, "red": {"value_start": 0, "value_range": 255, "period": 2, "offset": 0}, "green": {"value_start": 0, "value_range": 255, "period": 3, "offset": 120}, "blue": {"value_start": 0, "value_range": 255, "period": 4, "offset": 240},
# phrases to display and the number of seconds to elapse between phrases
"phrases": [
"Loading...", "Please be patient...", "This may take a while...",
"Almost done...", "Almost there...", "Just a little longer...",
"Please wait...", "Still working...",
],
"phrase_delay": 2
} Defaults are used for any keys that are not specified in the dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
Title of the window |
required |
config |
dict
|
Dictionary of configuration options as listed above |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 |
|
run(fn, *args, **kwargs)
Runs the function in a separate co-routine, while animating the progress bar in another.
Source code in pysimplesql\pysimplesql.py
5436 5437 5438 5439 5440 5441 5442 5443 |
|
KeyGen(separator='!')
The keygen system provides a mechanism to generate unique keys for use as PySimpleGUI element keys.
This is needed because many auto-generated items will have the same name. If for example you had two save buttons on the screen at the same time, they must have unique names. The keygen will append a separator and an incremental number to keys that would otherwise be duplicates. A global KeyGen instance is created automatically, see keygen for info.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
separator |
str
|
The default separator that goes between the key and the incremental number |
'!'
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 |
|
get(key, separator=None)
Get a generated key from the KeyGen.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The key from which to generate the new key. If the key has not been used before, then it will be returned unmodified. For each successive call with the same key, it will be appended with the separator character and an incremental number. For example, if the key 'button' was passed to get() 3 times in a row, then the keys 'button', 'button:1', and 'button:2' would be returned respectively. |
required |
separator |
str
|
(optional) override the default separator wth this separator |
None
|
Returns:
Type | Description |
---|---|
str
|
None |
Source code in pysimplesql\pysimplesql.py
5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 |
|
reset_key(key)
Reset the generation sequence for the supplied key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The base key to reset te sequence for |
required |
Source code in pysimplesql\pysimplesql.py
5589 5590 5591 5592 5593 5594 5595 5596 |
|
reset()
Reset the entire KeyGen and remove all keys.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5598 5599 5600 5601 5602 5603 5604 |
|
reset_from_form(frm)
Reset keys from the keygen that were from mapped PySimpleGUI elements of that Form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frm |
Form
|
The Form from which to get the list of mapped elements |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 |
|
LazyTable(*args, lazy_loading=False, **kwargs)
Bases: Table
The LazyTable is a subclass of sg.Table for improved performance by loading rows lazily during scroll events. Updating a sg.Table is generally fast, but with large DataSets that contain thousands of rows, there may be some noticeable lag. LazyTable overcomes this by only inserting a slice of rows during an [update()][pysimplesql.pysimplesql.update].
To use, simply replace sg.Table
with LazyTable as the 'element' argument in a
selector() function call in your layout.
Expects values in the form of [TableRow(pk, values)], and only becomes active after a update(values=, selected_rows=[int]) call.
Note
LazyTable does not support the sg.Table.row_colors
argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args |
|
()
|
|
lazy_loading |
bool
|
True to enable lazy loading |
False
|
**kwargs |
Additional |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 |
|
insert_qty
property
Number of rows to insert during an update(values=)
and scroll events.
SelectedRows
property
Returns the selected row(s) in the LazyTable.
Returns:
Type | Description |
---|---|
|
|
|
:note: This property assumes that the LazyTable is using a primary key (pk) value to uniquely identify rows in the data list.
Convenience
Convenience functions are a collection of functions and classes that aide in building PySimpleGUI layouts that conform to pysimplesql standards so that your database application is up and running quickly, and with all the great automatic functionality pysimplesql has to offer. See the documentation for the following convenience functions: field(), selector(), actions(), TableBuilder.
Note: This is a dummy class that exists purely to enhance documentation and has no use to the end user.
TableStyler
dataclass
TODO.
TableBuilder
dataclass
Bases: list
This is a convenience class used to build table headings for PySimpleGUI.
In addition, TableBuilder objects can sort columns in ascending or descending order by clicking on the column in the heading in the PySimpleGUI Table element if the sort_enable parameter is set to True.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_rows |
int
|
Number of rows to display in the table. |
required |
sort_enable |
bool
|
True to enable sorting by heading column. |
True
|
allow_cell_edits |
bool
|
Double-click to edit a cell value if True. Accepted edits
update both |
False
|
lazy_loading |
bool
|
For larger DataSets (see LazyTable). |
False
|
add_save_heading_button |
bool
|
Adds a save button to the left-most heading column if True. |
False
|
apply_search_filter |
bool
|
Filter rows to only those columns in search_order that contain [search_string][pysimplesql.pysimplesql.Dataself.search_string]. |
False
|
style |
TableStyler
|
see TableStyler. |
field(default_factory=TableStyler)
|
Returns:
Type | Description |
---|---|
None |
num_rows: int
instance-attribute
Number of rows to display in the table.
sort_enable: bool = True
class-attribute
instance-attribute
True to enable sorting by heading column.
allow_cell_edits: bool = False
class-attribute
instance-attribute
Double-click to edit a cell value if True. Accepted edits update both sg.Table
and associated field element. Note: primary key, generated, or [readonly][pysimplesql.pysimplesql.readonly] columns
don't allow cell edits.
lazy_loading: bool = False
class-attribute
instance-attribute
For larger DataSets (see LazyTable).
add_save_heading_button: bool = False
class-attribute
instance-attribute
Adds a save button to the left-most heading column if True.
apply_search_filter: bool = False
class-attribute
instance-attribute
Filter rows to only those columns in search_order that contain [search_string][pysimplesql.pysimplesql.Dataself.search_string].
heading_names: List[str]
property
Return a list of heading_names for use with the headings parameter of PySimpleGUI.Table.
Returns:
Type | Description |
---|---|
List[str]
|
a list of heading names |
columns
property
Return a list of column names.
Returns:
Type | Description |
---|---|
a list of column names |
col_justify_map: List[str]
property
Convenience method for creating PySimpleGUI tables.
Returns:
Type | Description |
---|---|
List[str]
|
a list column justifications for use with PySimpleGUI Table |
List[str]
|
cols_justification parameter |
heading_justify_map: List[str]
property
Convenience method for creating PySimpleGUI tables.
Returns:
Type | Description |
---|---|
List[str]
|
a list heading justifications for use with LazyTable [headings_justification][pysimplesql.pysimplesql.headings_justification] |
heading_anchor_map: List[str]
property
Internal method for passing directly to treeview heading() function.
Returns:
Type | Description |
---|---|
List[str]
|
a list heading anchors for use with treeview heading() function. |
visible_map: List[Union[bool, int]]
property
Convenience method for creating PySimpleGUI tables.
Returns:
Type | Description |
---|---|
List[Union[bool, int]]
|
a list of visible columns for use with th PySimpleGUI Table |
List[Union[bool, int]]
|
visible_column_map parameter |
width_map: List[int]
property
Convenience method for creating PySimpleGUI tables.
Returns:
Type | Description |
---|---|
List[int]
|
a list column widths for use with th PySimpleGUI Table col_widths parameter |
add_column(column, heading, width, col_justify='default', heading_justify='column', readonly=False, visible=True)
Add a new heading column to this TableBuilder object. Columns are added in the order that this method is called. Note that the primary key column does not need to be included, as primary keys are stored internally in the TableRow class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column |
str
|
The name of the column in the database |
required |
heading |
str
|
The name of this columns heading (title) |
required |
width |
int
|
The width for this column to display within the Table element |
required |
col_justify |
ColumnJustify
|
Default 'left'. Available options: 'left', 'right', 'center', 'default'. |
'default'
|
heading_justify |
HeadingJustify
|
Defaults to 'column' inherity [col_justify][pysimplesql.pysimplesql.col_justify]. Available options: 'left', 'right', 'center', 'column', 'default'. |
'column'
|
readonly |
bool
|
Indicates if the column is read-only when allow_cell_edits is True. |
False
|
visible |
bool
|
True if the column is visible. Typically, the only hidden column would be the primary key column if any. This is also useful if the rows DataFrame has information that you don't want to display. |
True
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 |
|
ThemePack(tp_dict=None)
ThemePacks are user-definable objects that allow for the look and feel of database applications built with PySimpleGUI + pysimplesql. This includes everything from icons, the ttk themes, to sounds. Pysimplesql comes with 3 pre-made ThemePacks: default (aka ss_small), ss_large and ss_text. Creating your own is easy as well! In fact, a ThemePack can be as simple as one line if you just want to change one aspect of the default ThemePack. Example: my_tp = {'search': 'Click here to search'} # I want a different search button.
Once a ThemePack is created, it's very easy to use. Here is a very simple example of using a ThemePack: ss.themepack(my_tp_dict_variable) # make a search button, using the 'search' key from the ThemePack sg.Button(ss.themepack.search, key='search_button')
Source code in pysimplesql\pysimplesql.py
8160 8161 8162 |
|
default: Dict[Any] = {'ttk_theme': 'default', 'use_ttk_buttons': True, 'default_element_pad': (5, 0), 'action_button_pad': (3, 0), 'popup_button_pad': (5, 5), 'edit_protect': b'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAGJ3pUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarVdZsuQmEPznFD4CVSwFx2GN8A18fCeiUG/zZtoRfnrdQoCKpDJJaDP++Xuav/DH7L3xQVLMM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eOCjibpRlGN08HgZFN0zaABAALhAwDGAAhXeDoA0gYsLsA7BFCnKTrnQv+H10/3LLabVHFAAAAAElFTkSuQmCC', 'search': 'Search', 'unsaved_column_header': '💾', 'unsaved_column_width': 3, 'marker_unsaved': '✱', 'marker_required': '✱', 'marker_required_color': 'red2', 'placeholder_color': 'grey', 'marker_sort_asc': '▼', 'marker_sort_desc': '▲', 'popup_info_auto_close_seconds': 1.5, 'popup_info_alpha_channel': 0.85, 'info_element_auto_erase_seconds': 5, 'live_update_typing_delay_seconds': 0.3, 'default_label_size': (15, 1), 'default_element_size': (30, 1), 'default_mline_size': (30, 7), 'use_cell_buttons': True, 'text_min_width': 80, 'combobox_min_width': 80, 'checkbox_min_width': 75, 'datepicker_min_width': 80, 'display_bool_as_checkbox': True, 'checkbox_true': '☑', 'checkbox_false': '☐', 'validate_exception_animation': lambda : shake_widget(widget)}
class-attribute
Default Themepack.
__call__(tp_dict=None)
Update the ThemePack object from tp_dict.
NOTE: You can add additional keys if desired
tp_example = { 'ttk_theme : the name of a ttk theme 'edit_protect' : either base64 image (eg b''), or string eg '', f'' 'quick_edit' : either base64 image (eg b''), or string eg '', f'' 'save' : either base64 image (eg b''), or string eg '', f'' 'first' : either base64 image (eg b''), or string eg '', f'' 'previous' : either base64 image (eg b''), or string eg '', f'' 'next' : either base64 image (eg b''), or string eg '', f'' 'last' : either base64 image (eg b'') or a string eg '', f'' 'insert' : either base64 image (eg b''), or string eg '', f'' 'delete' : either base64 image (eg b''), or string eg '', f'' 'duplicate' : either base64 image (eg b''), or string eg '', f'' 'search' : either base64 image (eg b''), or string eg '', f'' 'marker_unsaved' : string eg '', f'', unicode 'marker_required' : string eg '', f'', unicode 'marker_required_color': string eg 'red', Tuple eg (255,0,0) 'marker_sort_asc': string eg '', f'', unicode 'marker_sort_desc': string eg '', f'', unicode }
For Base64, you can convert a whole folder using https://github.com/PySimpleGUI/PySimpleGUI-Base64-Encoder # fmt: skip Remember to us b'' around the string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tp_dict |
Dict[str, str]
|
(optional) A dict formatted as above to create the ThemePack from. If one is not supplied, a default ThemePack will be generated. Any keys not present in the supplied tp_dict will be generated from the default values. Additionally, tp_dict may contain additional keys not specified in the minimal default ThemePack. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 |
|
LanguagePack(lp_dict=None)
LanguagePacks are user-definable collections of strings that allow for localization of strings and messages presented to the end user.
Creating your own is easy as well! In fact, a LanguagePack can be as simple as one line if you just want to change one aspect of the default LanguagePack. Example: # I want the save popup to display this text in English in all caps lp_en = {'save_success': 'SAVED!'}
Source code in pysimplesql\pysimplesql.py
8378 8379 8380 |
|
default: Dict[Any] = {'button_cancel': ' Cancel ', 'button_ok': ' OK ', 'button_yes': ' Yes ', 'button_no': ' No ', 'description_column_str_null_default': 'New Record', 'notnull_placeholder': '*Required', 'search_placeholder': '🔍 Search...', 'combo_placeholder': 'Please select one:', 'duplicate_prepend': 'Copy of ', 'startup_form': 'Creating Form', 'startup_init': 'Initializing', 'startup_datasets': 'Adding datasets', 'startup_relationships': 'Adding relationships', 'startup_binding': 'Binding window to Form', 'SQLDriver_init': '{name} connection', 'SQLDriver_connecting': 'Connecting to database', 'SQLDriver_execute': 'Executing SQL commands', 'SQLDriver_file_not_found_title': 'Trouble finding db file', 'SQLDriver_file_not_found': 'Could not find file\n{file}', 'animate_phrases': ['Please wait...', 'Still working...'], 'info_popup_title': 'Info', 'form_save_success': 'Updates saved successfully.', 'form_save_none': 'There were no updates to save.', 'dataset_save_empty': 'There were no updates to save.', 'dataset_save_none': 'There were no changes to save!', 'dataset_save_success': 'Updates saved successfully.', 'form_prompt_save_title': 'Unsaved Changes', 'form_prompt_save': 'You have unsaved changes!\nWould you like to save them first?', 'dataset_prompt_save_title': 'Unsaved Changes', 'dataset_prompt_save': 'You have unsaved changes!\nWould you like to save them first?', 'form_save_problem_title': 'Problem Saving', 'form_save_partial': 'Some updates were saved successfully;', 'form_save_problem': 'There was a problem saving updates to the following tables:\n{tables}.', 'dataset_save_callback_false_title': 'Callback Prevented Save', 'dataset_save_callback_false': 'Updates not saved.', 'dataset_save_keyed_fail_title': 'Problem Saving', 'dataset_save_keyed_fail': 'Query failed: {exception}.', 'dataset_save_fail_title': 'Problem Saving', 'dataset_save_fail': 'Query failed: {exception}.', 'dataset_search_failed_title': 'Search Failed', 'dataset_search_failed': 'Failed to find:\n{search_string}', 'delete_title': 'Confirm Deletion', 'delete_cascade': 'Are you sure you want to delete this record?\nKeep in mind that child records:\n({children})\nwill also be deleted!', 'delete_single': 'Are you sure you want to delete this record?', 'delete_failed_title': 'Problem Deleting', 'delete_failed': 'Query failed: {exception}.', 'delete_recursion_limit_error': 'Delete Cascade reached max recursion limit.\nDELETE_CASCADE_RECURSION_LIMIT', 'duplicate_child_title': 'Confirm Duplication', 'duplicate_child': 'This record has child records:\n(in {children})\nWhich records would you like to duplicate?', 'duplicate_child_button_dupparent': 'Only duplicate this record.', 'duplicate_child_button_dupboth': '++ Duplicate this record and its children.', 'duplicate_single_title': 'Confirm Duplication', 'duplicate_single': 'Are you sure you want to duplicate this record?', 'duplicate_failed_title': 'Problem Duplicating', 'duplicate_failed': 'Query failed: {exception}.', 'error_title': 'Error', 'quick_edit_title': 'Quick Edit - {data_key}', 'import_module_failed_title': 'Problem importing module', 'import_module_failed': 'Unable to import module neccessary for {name}\nException: {exception}\n\nTry `pip install {requires}`', 'overwrite_title': 'Overwrite file?', 'overwrite': 'File exists, type YES to overwrite', 'overwrite_prompt': 'YES', 'dataset_save_validate_error_title': 'Error: Invalid Input(s)', 'dataset_save_validate_error_header': 'The following fields(s) have issues:\n', 'dataset_save_validate_error_field': '{field}: ', ValidateRule.REQUIRED: 'Field is required', ValidateRule.PYTHON_TYPE: '{value} could not be cast to correct type, {rule}', ValidateRule.PRECISION: '{value} exceeds max precision length, {rule}', ValidateRule.MIN_VALUE: '{value} less than minimum value, {rule}', ValidateRule.MAX_VALUE: '{value} more than max value, {rule}', ValidateRule.MIN_LENGTH: '{value} less than minimum length, {rule}', ValidateRule.MAX_LENGTH: '{value} more than max length, {rule}', ValidateRule.CUSTOM: '{value}{rule}'}
class-attribute
Default LanguagePack.
__call__(lp_dict=None)
Update the LanguagePack instance.
Source code in pysimplesql\pysimplesql.py
8406 8407 8408 8409 8410 |
|
LangFormat
Bases: dict
This is a convenience class used by LanguagePack format_map calls, allowing users to not include expected variables.
Note: This is typically not used by the end user.
Abstractions
Supporting multiple databases in your application can quickly become very complicated and unmanageable. pysimplesql abstracts all of this complexity and presents a unified API via abstracting the main concepts of database programming. See the following documentation for a better understanding of how this is accomplished. Column, ColumnInfo, SQLDriver, Sqlite, Mysql, Postgres.
Note: This is a dummy class that exists purely to enhance documentation and has no use to the end user.
Column
dataclass
Base [ColumnClass][pysimplesql.pysimplesql.ColumnClass] represents a SQL column and helps casting/validating values.
The Column class is a generic column class. It holds a dict containing the column name, type whether the column is notnull, whether the column is a primary key and the default value, if any. Columns are typically stored in a ColumnInfo collection. There are multiple ways to get information from a Column, including subscript notation, and via properties. The available column info via these methods are name, domain, notnull, default and pk See example:
.. literalinclude:: ../doc_examples/Column.1.py :language: python :caption: Example code
cast(value)
Cast a value to the appropriate data type as defined by the column info for the column. This can be useful for comparing values between the database and the GUI.
:param value: The value you would like to cast :returns: The value, cast to a type as defined by the domain
Source code in pysimplesql\pysimplesql.py
8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 |
|
validate(value)
TODO.
Source code in pysimplesql\pysimplesql.py
8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 |
|
MinMaxCol
dataclass
Bases: Column
Base ColumnClass for columns with minimum and maximum constraints.
This class extends the functionality of the base Column class to include optional validation based on minimum and maximum values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_value |
Any valid value type compatible with the column's data type.
|
The minimum allowed value for the column (inclusive). Defaults to None, indicating no minimum constraint. |
None
|
max_value |
Any valid value type compatible with the column's data type.
|
The maximum allowed value for the column (inclusive). Defaults to None, indicating no maximum constraint. |
None
|
LengthCol
dataclass
Bases: Column
Base ColumnClass for length-constrained columns.
This class represents a column with length constraints. It inherits from the base Column class and adds attributes to store the maximum and minimum length values. The [validate][pysimplesql.pysimplesql.validate] method is overridden to include length validations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_length |
int
|
Maximum length allowed for the column value. |
None
|
min_length |
int
|
Minimum length allowed for the column value. |
None
|
LocaleCol
dataclass
Bases: Column
Base ColumnClass that provides Locale functions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
negative_symbol |
str
|
The symbol representing negative values in the locale. |
localeconv()['negative_sign']
|
currency_symbol |
str
|
The symbol representing the currency in the locale. |
localeconv()['currency_symbol']
|
Example
col = LocaleCol() normalized_value = col.strip_locale("$1,000.50")
ColumnInfo(driver, table)
Bases: List
Custom container that behaves like a List containing a collection of [Columns][pysimplesql.pysimplesql.Columns].
This class is responsible for maintaining information about all the columns (Column) in a table. While the individual Column elements of this collection contain information such as default values, primary key status, SQL data type, column name, and the notnull status - this class ties them all together into a collection and adds functionality to set default values for null columns and retrieve a dict representing a table row with all defaults already assigned. See example below: .. literalinclude:: ../doc_examples/ColumnInfo.1.py :language: python :caption: Example code
Source code in pysimplesql\pysimplesql.py
8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 |
|
pk_column: Union[str, None]
property
Get the pk_column for this colection of column_info.
Returns:
Type | Description |
---|---|
Union[str, None]
|
A string containing the column name of the PK column, or None if one was not |
Union[str, None]
|
found |
names: List[str]
property
Return a List of column names from the Columns in this collection.
Returns:
Type | Description |
---|---|
List[str]
|
List of column names |
col_name(idx)
Get the column name located at the specified index in this collection of Columns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx |
int
|
The index of the column to get the name from |
required |
Returns:
Type | Description |
---|---|
str
|
The name of the column at the specified index |
Source code in pysimplesql\pysimplesql.py
8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 |
|
default_row_dict(dataset)
Return a dictionary of a table row with all defaults assigned.
This is useful for inserting new records to prefill the GUI elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
DataSet
|
a pysimplesql DataSet object |
required |
Returns:
Type | Description |
---|---|
dict
|
dict |
Source code in pysimplesql\pysimplesql.py
8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 |
|
set_null_default(python_type, value)
Set a Null default for a single python type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
python_type |
str
|
This should be equal to what calling |
required |
value |
object
|
The new value to set the SQL type to. This can be a literal or even a callable |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 |
|
set_null_defaults(null_defaults)
Set Null defaults for all python types.
'str', 'int', 'float', 'Decimal', 'bool',
'time', 'date', or 'datetime'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
null_defaults |
dict
|
A dict of python types and default values. This can be a literal or even a callable |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 |
|
get_virtual_names()
Get a list of virtual column names.
Returns:
Type | Description |
---|---|
List[str]
|
A List of column names that are virtual, or [] if none are present in this |
List[str]
|
collections |
Source code in pysimplesql\pysimplesql.py
9073 9074 9075 9076 9077 9078 9079 9080 |
|
Result
This is a "dummy" Result object that is a convenience for constructing a DataFrame that has the expected attrs set.
set(row_data=None, lastrowid=None, exception=None, column_info=None)
classmethod
Create a pandas DataFrame with the row data and expected attrs set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_data |
dict
|
A list of dicts of row data |
None
|
lastrowid |
int
|
The inserted row ID from the last INSERT statement |
None
|
exception |
Exception
|
Exceptions passed back from the SQLDriver |
None
|
column_info |
ColumnInfo
|
(optional) ColumnInfo object |
None
|
Source code in pysimplesql\pysimplesql.py
9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 |
|
SqlChar
dataclass
Container for passing database-specific characters.
Each database type expects their SQL prepared in a certain way. Defaults in this dataclass are set for how various elements in the SQL string should be quoted and represented as placeholders. Override these in the derived class as needed to satisfy SQL requirements
placeholder: str = '%s'
class-attribute
instance-attribute
The placeholder for values in the query string. This is typically '?' or'%s'
table_quote: str = ''
class-attribute
instance-attribute
Character to quote table. (defaults to no quotes)
column_quote: str = ''
class-attribute
instance-attribute
Chacter to quote column. (defaults to no quotes)
value_quote: str = "'"
class-attribute
instance-attribute
Character to quote value. (defaults to single quotes)
SQLDriver
dataclass
Bases: ABC
Abstract SQLDriver class. Derive from this class to create drivers that conform to PySimpleSQL. This ensures that the same code will work the same way regardless of which database is used. There are a few important things to note: The commented code below is broken into methods that MUST be implemented in the derived class, methods that.
SHOULD be implemented in the derived class, and methods that MAY need to be implemented in the derived class for it to work as expected. Most derived drivers will at least partially work by implementing the MUST have methods.
See the source code for Sqlite, Mysql and Postgres for examples of how to construct your own driver.
NOTE: SQLDriver.execute() should return a pandas DataFrame. Additionally, by pysimplesql convention, the attrs["lastrowid"] should always be None unless and INSERT query is executed with SQLDriver.execute() or a record is inserted with SQLDriver.insert_record()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
Host. |
None
|
user |
str
|
User. |
None
|
password |
str
|
Password. |
None
|
database |
str
|
Name of database. |
None
|
sql_script |
str
|
(optional) SQL script file to execute after opening the database. |
None
|
sql_script_encoding |
str
|
The encoding of the SQL script file. Defaults to 'utf-8'. |
'utf-8'
|
sql_commands |
str
|
(optional) SQL commands to execute after opening the database. Note: sql_commands are executed after sql_script. |
None
|
update_cascade |
bool
|
(optional) Default:True. Requery and filter child table on selected parent primary key. (ON UPDATE CASCADE in SQL) |
True
|
delete_cascade |
bool
|
(optional) Default:True. Delete the dependent child records if the parent table record is deleted. (ON UPDATE DELETE in SQL) |
True
|
sql_char |
InitVar[SqlChar]
|
(optional) SqlChar object, if non-default chars desired. |
SqlChar()
|
connect(*args, **kwargs)
abstractmethod
Connect to a database.
Connect to a database in the connect() method, assigning the connection to self.con.
Implementation varies by database, you may need only one parameter, or several depending on how a connection is established with the target database.
Source code in pysimplesql\pysimplesql.py
9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 |
|
execute(query, values=None, column_info=None, auto_commit_rollback=False)
abstractmethod
Execute a query.
Implements the native SQL implementation's execute() command.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
The query string to execute |
required | |
values |
Values to pass into the query to replace the placeholders |
None
|
|
column_info |
ColumnInfo
|
An optional ColumnInfo object |
None
|
auto_commit_rollback |
bool
|
Automatically commit or rollback depending on whether an exception was handled. Set to False by default. Set to True to have exceptions and commit/rollbacks happen automatically |
False
|
Source code in pysimplesql\pysimplesql.py
9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 |
|
check_keyword(keyword, key=None)
Check keyword to see if it is a reserved word. If it is raise a ReservedKeywordError. Checks to see if the database name is in keys and uses the database name for the key if it exists, otherwise defaults to 'common' in the RESERVED set. Override this with the specific key for the database if needed for best results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keyword |
str
|
the value to check against reserved words |
required |
key |
str
|
The key in the RESERVED set to check in |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 |
|
commit()
Commit a transaction.
Source code in pysimplesql\pysimplesql.py
9387 9388 9389 |
|
generate_join_clause(dataset)
Automatically generates a join clause from the Relationships that have been set.
This typically isn't used by end users.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A join string to be used in a sqlite3 query |
Source code in pysimplesql\pysimplesql.py
9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 |
|
generate_where_clause(dataset)
Generates a where clause from the Relationships that have been set, as well as the DataSet's where clause.
This is not typically used by end users.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A where clause string to be used in a sqlite3 query |
Source code in pysimplesql\pysimplesql.py
9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 |
|
generate_query(dataset, join_clause=True, where_clause=True, order_clause=True)
staticmethod
Generate a query string using the relationships that have been set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
DataSet
|
A DataSet object |
required |
join_clause |
bool
|
True to auto-generate 'join' clause, False to not |
True
|
where_clause |
bool
|
True to auto-generate 'where' clause, False to not |
True
|
order_clause |
bool
|
True to auto-generate 'order by' clause, False to not |
True
|
Returns:
Type | Description |
---|---|
str
|
a query string for use with sqlite3 |
Source code in pysimplesql\pysimplesql.py
9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 |
|
duplicate_record(dataset, children)
Duplicates a record in a database table and optionally duplicates its dependent records.
The function uses all columns found in [column_info][pysimplesql.pysimplesql.DataSet.column_info] and select all except the primary key column, inserting a duplicate record with the same column values.
If the 'children' parameter is set to 'True', the function duplicates the dependent records by setting the foreign key column of the child records to the primary key value of the newly duplicated record before inserting them.
Note that this function assumes the primary key column is auto-incrementing and that no columns are set to unique.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
DataSet
|
The DataSet of the the record to be duplicated. |
required |
children |
bool
|
(optional) Whether to duplicate dependent records. Defaults to False. |
required |
Source code in pysimplesql\pysimplesql.py
9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 |
|
add_relationship(join, child_table, fk_column, parent_table, pk_column, update_cascade, delete_cascade)
Add a foreign key relationship between two dataset of the database.
When you attach a database, PySimpleSQL isn't aware of the relationships contained until datasets are added via add_dataset, and the relationship of various tables is set with this function. Note that auto_add_relationships() will do this automatically from the schema of the database, which also happens automatically when a SQLDriver is created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
join |
str
|
The join type of the relationship ('LEFT JOIN', 'INNER JOIN', 'RIGHT JOIN') |
required |
child_table |
str
|
The child table containing the foreign key |
required |
fk_column |
str
|
The foreign key column of the child table |
required |
parent_table |
str
|
The parent table containing the primary key |
required |
pk_column |
str
|
The primary key column of the parent table |
required |
update_cascade |
bool
|
Requery and filter child table results on selected parent primary key (ON UPDATE CASCADE in SQL) |
required |
delete_cascade |
bool
|
Delete the dependent child records if the parent table record is deleted (ON UPDATE DELETE in SQL) |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 |
|
auto_add_relationships()
Automatically add a foreign key relationship between tables of the database. This is done by foreign key constraints within the database. Automatically requery the child table if the parent table changes (ON UPDATE CASCADE in sql is set) When you attach a database, PySimpleSQL isn't aware of the relationships contained until tables are added and the relationship of various tables is set. This happens automatically during SQLDriver creation. Note that add_relationship() can do this manually.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 |
|
check_reserved_keywords(value)
SQLDrivers can check to make sure that field names respect their own reserved keywords. By default, all SQLDrivers will check for their respective keywords. You can choose to disable this feature with this method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
bool
|
True to check for reserved keywords in field names, false to skip this check |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 |
|
Sqlite(database=None, *, sql_script=None, sql_script_encoding='utf-8', sql_commands=None, update_cascade=True, delete_cascade=True, sql_char=sql_char, create_file=True, skip_sql_if_db_exists=True)
dataclass
Bases: SQLDriver
The SQLite driver supports SQLite3 databases.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
database |
Union[str, Path, Literal[':memory:'], Connection]
|
Path to database file, ':memory:' in-memory database, or existing Sqlite3.Connection |
None
|
sql_script |
(optional) SQL script file to execute after opening the db. |
None
|
|
sql_script_encoding |
str
|
(optional) The encoding of the SQL script file. Defaults to 'utf-8'. |
'utf-8'
|
sql_commands |
(optional) SQL commands to execute after opening the database. Note: sql_commands are executed after sql_script. |
None
|
|
update_cascade |
bool
|
(optional) Default:True. Requery and filter child table on selected parent primary key. (ON UPDATE CASCADE in SQL) |
True
|
delete_cascade |
bool
|
(optional) Default:True. Delete the dependent child records if the parent table record is deleted. (ON UPDATE DELETE in SQL) |
True
|
sql_char |
SqlChar
|
(optional) SqlChar object, if non-default chars desired. |
sql_char
|
create_file |
bool
|
(optional) default True. Create file if it doesn't exist. |
True
|
skip_sql_if_db_exists |
bool
|
(optional) Skip both 'sql_file' and 'sql_commands' if database already exists. |
True
|
Source code in pysimplesql\pysimplesql.py
9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 |
|
Flatfile(file_path, delimiter=',', quotechar='"', header_row_num=0, table=None, pk_col=None)
dataclass
Bases: Sqlite
The Flatfile driver adds support for flatfile databases such as CSV files to pysimplesql.
The flatfile data is loaded into an internal SQlite database, where it can be used and manipulated like any other database file. Each timem records are saved, the contents of the internal SQlite database are written back out to the file. This makes working with flatfile data as easy and consistent as any other database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
The path to the flatfile |
required |
delimiter |
str
|
The delimiter for the flatfile. Defaults to ','. Tabs ('\t') are another popular option |
','
|
quotechar |
str
|
The quoting character specified by the flatfile. Defaults to '"' |
'"'
|
header_row_num |
int
|
The row containing the header column names. Defaults to 0 |
0
|
table |
str
|
The name to give this table in pysimplesql. Default is 'Flatfile' |
None
|
pk_col |
str
|
The column name that acts as a primary key for the dataset. See below how to use this parameter: - If no pk_col parameter is supplied, then a generic primary key column named 'pk' will be generated with AUTO INCREMENT and PRIMARY KEY set. This is a virtual column and will not be written back out to the flatfile. - If the pk_col parameter is supplied, and it exists in the header row, then it will be used as the primary key for the dataset. If this column does not exist in the header row, then a virtual primary key column with this name will be created with AUTO INCREMENT and PRIMARY KEY set. As above, the virtual primary key column that was created will not be written to the flatfile. |
None
|
Source code in pysimplesql\pysimplesql.py
10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 |
|
Mysql
dataclass
Bases: SQLDriver
The Mysql driver supports MySQL databases.
tinyint1_is_boolean: bool = True
class-attribute
instance-attribute
Treat SQL column-type 'tinyint(1)' as Boolean
MySQL does not have a true 'Boolean' column. Instead, a column is declared as 'Boolean' will be stored as 'tinyint(1)'. Setting this arg as 'True' will map the [ColumnClass][pysimplesql.pysimplesql.ColumnClass] as a [BoolCol][pysimplesql.pysimplesql.BoolCol].
Mariadb
dataclass
Postgres
dataclass
Bases: SQLDriver
The Postgres driver supports PostgreSQL databases.
sync_sequences: bool = False
class-attribute
instance-attribute
Synchronize the sequences with the max pk for each table on database connection.
This is useful if manual records were inserted without calling nextval() to update the sequencer.
Sqlserver
dataclass
MSAccess(database_file, *, overwrite_file=False, sql_script=None, sql_script_encoding='utf-8', sql_commands=None, update_cascade=True, delete_cascade=True, sql_char=sql_char, infer_datetype_from_default_function=True, use_newer_jackcess=False)
dataclass
Bases: SQLDriver
The MSAccess driver supports Microsoft Access databases. Note that only database interactions are supported, including stored Queries, but not operations dealing with Forms, Reports, etc.
Note: Jackcess and UCanAccess libraries may not accurately report decimal places for "Number" or "Currency" columns. Manual configuration of decimal places may be required by replacing the placeholders as follows: frm[DATASET KEY].column_info[COLUMN NAME].scale = 2
Parameters:
Name | Type | Description | Default |
---|---|---|---|
database_file |
Union[str, Path]
|
The path to the MS Access database file. |
required |
overwrite_file |
bool
|
If True, prompts the user if the file already exists. If the user declines to overwrite the file, the provided SQL commands or script will not be executed. |
False
|
sql_script |
str
|
(optional) SQL script file to execute after opening the db. |
None
|
sql_script_encoding |
str
|
The encoding of the SQL script file. Defaults to 'utf-8'. |
'utf-8'
|
sql_commands |
str
|
(optional) SQL commands to execute after opening the database. Note: sql_commands are executed after sql_script. |
None
|
update_cascade |
bool
|
(optional) Default:True. Requery and filter child table on selected parent primary key. (ON UPDATE CASCADE in SQL) |
True
|
delete_cascade |
bool
|
(optional) Default:True. Delete the dependent child records if the parent table record is deleted. (ON UPDATE DELETE in SQL) |
True
|
sql_char |
SqlChar
|
(optional) SqlChar object, if non-default chars desired. |
sql_char
|
infer_datetype_from_default_function |
bool
|
If True, specializes a DateTime column by examining the column's default function. A DateTime column with '=Date()' will be treated as a 'DateCol', and '=Time()' will be treated as a 'TimeCol'. Defaults to True. |
True
|
use_newer_jackcess |
bool
|
If True, uses a newer version of the Jackcess library for improved compatibility, specifically allowing handling of 'attachment' columns. Defaults to False. |
False
|
Source code in pysimplesql\pysimplesql.py
11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 |
|
Driver
process_events(event, values)
Process mapped events for ALL Form instances.
Not to be confused with process_events(), which processes events for individual Form instances. This should be called once per iteration in your event loop. Note: Events handled are responsible for requerying and updating elements as needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
str
|
The event returned by PySimpleGUI.read() |
required |
values |
list
|
the values returned by PySimpleGUI.read() |
required |
Returns:
Type | Description |
---|---|
bool
|
True if an event was handled, False otherwise |
Source code in pysimplesql\pysimplesql.py
4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 |
|
update_elements(data_key=None, edit_protect_only=False)
Updated the GUI elements to reflect values from the database for ALL Form instances. Not to be confused with update_elements(), which updates GUI elements for individual Form instances.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_key |
str
|
(optional) key of DataSet to update elements for, otherwise updates elements for all datasets. |
None
|
edit_protect_only |
bool
|
(optional) If true, only update items affected by edit_protect. |
False
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 |
|
bind(win)
Bind all Form instances to specific window.
Not to be confused with bind(), which binds specific form to the window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
win |
Window
|
The PySimpleGUI window to bind all forms to |
required |
Source code in pysimplesql\pysimplesql.py
4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 |
|
simple_transform(dataset, row, encode)
Convenience transform function that makes it easier to add transforms to your records.
Source code in pysimplesql\pysimplesql.py
4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 |
|
update_table_element(window, element, values, select_rows)
Updates a PySimpleGUI sg.Table with new data and suppresses extra events emitted.
Call this function instead of simply calling update() on a sg.Table element.
Without unbinding the virtual "<
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window |
Window
|
A PySimpleGUI Window containing the sg.Table element to be updated. |
required |
element |
Type[Table]
|
The sg.Table element to be updated. |
required |
values |
List[TableRow]
|
A list of table rows to update the sg.Table with. |
required |
select_rows |
List[int]
|
List of rows to select as if user did. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in pysimplesql\pysimplesql.py
4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 |
|
checkbox_to_bool(value)
Allows a variety of checkbox values to still return True or False.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Union[str, int, bool]
|
Value to convert into True or False |
required |
Returns:
Type | Description |
---|---|
bool
|
bool |
Source code in pysimplesql\pysimplesql.py
5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 |
|
shake_widget(widget, pixels=4, delay_ms=50, repeat=2)
Shakes the given widget by modifying its padx attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget |
Union[Element, Widget]
|
The widget to shake. Must be an instance of sg.Element or tk.Widget. |
required |
pixels |
int
|
The number of pixels by which to shake the widget horizontally. |
4
|
delay_ms |
int
|
The delay in milliseconds between each shake movement. |
50
|
repeat |
int
|
The number of times to repeat the shaking movement. |
2
|
Source code in pysimplesql\pysimplesql.py
5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 |
|
field(field, element=_EnhancedInput, size=None, label='', no_label=False, label_above=False, quick_editor=True, quick_editor_kwargs=None, filter=None, key=None, use_ttk_buttons=None, pad=None, **kwargs)
Convenience function for adding PySimpleGUI elements to the Window, so they are properly configured for pysimplesql. The automatic functionality of pysimplesql relies on accompanying metadata so that the auto_map_elements() can pick them up. This convenience function will create a text label, along with an element with the above metadata already set up for you. Note: The element key will default to the field name if none is supplied.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
The database record in the form of table.column I.e. 'Journal.entry' |
required |
element |
Union[Type[Checkbox], Type[Combo], Type[Input], Type[Multiline]]
|
(optional) The element type desired (defaults to PySimpleGUI.Input) |
_EnhancedInput
|
size |
Tuple[int, int]
|
Overrides the default element size for this element only. |
None
|
label |
str
|
The text/label will automatically be generated from the column name. If a different text/label is desired, it can be specified here. |
''
|
no_label |
bool
|
Do not automatically generate a label for this element |
False
|
label_above |
bool
|
Place the label above the element instead of to the left. |
False
|
quick_editor |
bool
|
For records that reference another table, place a quick edit button next to the element |
True
|
quick_editor_kwargs |
dict
|
Additional keyword arguments to pass to quick editor. |
None
|
filter |
None
|
||
key |
(optional) The key to give this element. See note above about the default auto generated key. |
None
|
|
use_ttk_buttons |
Use ttk buttons for all action buttons. If None, defaults to setting [use_ttk_buttons][pysimplesql.pysimplesql.ThemePack.use_ttk_buttons]. |
None
|
|
pad |
The padding to use for the generated elements. If None, defaults to setting [default_element_pad][pysimplesql.pysimplesql.ThemePack.default_element_pad]. |
None
|
|
**kwargs |
Any additional arguments will be passed to the PySimpleGUI element. |
{}
|
Returns:
Type | Description |
---|---|
Column
|
Element(s) to be used in the creation of PySimpleGUI layouts. Note that this |
Column
|
function actually creates multiple Elements wrapped in a PySimpleGUI Column, but |
Column
|
can be treated as a single Element. |
Source code in pysimplesql\pysimplesql.py
6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 |
|
actions(table, key=None, default=True, edit_protect=None, navigation=None, insert=None, delete=None, duplicate=None, save=None, search=None, search_size=(30, 1), bind_return_key=True, filter=None, use_ttk_buttons=None, pad=None, **kwargs)
Allows for easily adding record navigation and record action elements to the PySimpleGUI window The navigation elements are generated automatically (first, previous, next, last and search). The action elements can be customized by selecting which ones you want generated from the parameters available. This allows full control over what is available to the user of your database application. Check out ThemePack to give any of these autogenerated controls a custom look!.
Note: By default, the base element keys generated for PySimpleGUI will be
table:action
using the name of the table passed in the table parameter plus the
action strings below separated by a colon: (I.e. Journal:table_insert) edit_protect,
db_save, table_first, table_previous, table_next, table_last, table_duplicate,
table_insert, table_delete, search_input, search_button. If you supply a key with
the key parameter, then these additional strings will be appended to that key. Also
note that these autogenerated keys also pass through the KeyGen, so it's possible
that these keys could be table_last:action!1, table_last:action!2, etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table name that this "element" will provide actions for |
required |
key |
(optional) The base key to give the generated elements |
None
|
|
default |
bool
|
Default edit_protect, navigation, insert, delete, save and search to either true or false (defaults to True) The individual keyword arguments will trump the default parameter. This allows for starting with all actions defaulting to False, then individual ones can be enabled with True - or the opposite by defaulting them all to True, and disabling the ones not needed with False. |
True
|
edit_protect |
bool
|
An edit protection mode to prevent accidental changes in the database. It is a button that toggles the ability on and off to prevent accidental changes in the database by enabling/disabling the insert, edit, duplicate, delete and save buttons. |
None
|
navigation |
bool
|
The standard << < > >> (First, previous, next, last) buttons for navigation |
None
|
insert |
bool
|
Button to insert new records |
None
|
delete |
bool
|
Button to delete current record |
None
|
duplicate |
bool
|
Button to duplicate current record |
None
|
save |
bool
|
Button to save record. Note that the save button feature saves changes made to any table, therefore only one save button is needed per window. |
None
|
search |
bool
|
A search Input element. Size can be specified with the 'search_size' parameter |
None
|
search_size |
Tuple[int, int]
|
The size of the search input element |
(30, 1)
|
bind_return_key |
bool
|
Bind the return key to the search button. Defaults to true. |
True
|
filter |
str
|
None
|
|
use_ttk_buttons |
bool
|
Use ttk buttons for all action buttons. If None, defaults to setting [use_ttk_buttons][pysimplesql.pysimplesql.ThemePack.use_ttk_buttons]. |
None
|
pad |
The padding to use for the generated elements. If None, defaults to setting [action_button_pad][pysimplesql.pysimplesql.ThemePack.action_button_pad]. |
None
|
|
**kwargs |
Any additional arguments will be passed to the PySimpleGUI element. |
{}
|
Returns:
Type | Description |
---|---|
Column
|
An element to be used in the creation of PySimpleGUI layouts. Note that this is |
Column
|
technically multiple elements wrapped in a PySimpleGUI.Column, but acts as one |
Column
|
element for the purpose of layout building. |
Source code in pysimplesql\pysimplesql.py
6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 |
|
selector(table, element=sg.Listbox, size=None, filter=None, key=None, **kwargs)
Selectors in pysimplesql are special elements that allow the user to change records in the database application. For example, Listboxes, Comboboxes and Tables all provide a convenient way to users to choose which record they want to select. This convenience function makes creating selectors very quick and as easy as using a normal PySimpleGUI element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
str
|
The table name that this selector will act on. |
required |
element |
Union[Type[Combo], Type[LazyTable], Type[Listbox], Type[Slider], Type[Table], TableBuilder]
|
The type of element you would like to use as a selector (defaults to a Listbox) |
Listbox
|
size |
Tuple[int, int]
|
The desired size of this selector element |
None
|
filter |
str
|
None
|
|
key |
str
|
(optional) The key to give to this selector. If no key is provided, it will default to table:selector using the name specified in the table parameter. This is also passed through the keygen, so if selectors all use the default name, they will be made unique. ie: Journal:selector!1, Journal:selector!2, etc. |
None
|
**kwargs |
Any additional arguments supplied will be passed on to the PySimpleGUI element. Note: TableBuilder objects bring their own kwargs. |
{}
|
Source code in pysimplesql\pysimplesql.py
7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 |
|