Skip to content

Commit b84643d

Browse files
committed
refs #281, Purge virtual working
DataSet.purge_virtual is now working. Also added some pandas display options for easier debugging
1 parent 3ebcd20 commit b84643d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

examples/SQLite_examples/Journal.db

0 Bytes
Binary file not shown.

pysimplesql/pysimplesql.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@
9393

9494
logger = logging.getLogger(__name__)
9595

96+
# -------------------------------------------
97+
# Set up options for pandas DataFrame display
98+
# -------------------------------------------
99+
pd.set_option("display.max_rows", 15) # Show a maximum of 10 rows
100+
pd.set_option("display.max_columns", 10) # Show a maximum of 5 columns
101+
pd.set_option("display.width", 250) # Set the display width to 1000 characters
102+
pd.set_option(
103+
"display.max_colwidth", 25
104+
) # Set the maximum column width to 20 characters
105+
pd.set_option("display.precision", 2) # Set the number of decimal places to 2
106+
96107
# ---------------------------
97108
# Types for automatic mapping
98109
# ---------------------------
@@ -1374,6 +1385,11 @@ def set_by_pk(
13741385
self.prompt_save(update_elements=False)
13751386

13761387
# find current index of pk in resorted rows (not in-place)
1388+
print(f"\nself.rows for {self.table}:\n", self.rows)
1389+
# for i, row in self.rows.iterrows():
1390+
# if row[self.pk_column] == pk:
1391+
# self.current_index = i
1392+
# break
13771393
self.current_index = (
13781394
self.rows.sort_index().index[self.rows[self.pk_column] == pk].tolist()[0]
13791395
)
@@ -1691,7 +1707,7 @@ def save_record(
16911707
self.frm.popup.ok(
16921708
lang.dataset_save_fail_title,
16931709
lang.dataset_save_fail.format_map(
1694-
LangFormat(exception=result.exception)
1710+
LangFormat(exception=result.attrs["exception"])
16951711
),
16961712
)
16971713
self.driver.rollback()
@@ -1828,7 +1844,7 @@ def delete_record(
18281844
return True
18291845

18301846
if self.row_is_virtual():
1831-
self.rows.purge_virtual()
1847+
self.purge_virtual()
18321848
self.frm.update_elements(self.key)
18331849
# only need to reset the Insert button
18341850
self.frm.update_elements(edit_protect_only=True)

0 commit comments

Comments
 (0)