From 04e7600c63c314dcbcf405a93c028b69d94cf0b2 Mon Sep 17 00:00:00 2001 From: cccs-nik <68961854+cccs-nik@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:42:57 -0400 Subject: [PATCH] deep copying pandas dataframe for caching (#163) --- jupyterlab_sql_editor/ipython_magic/sparksql/sparksql.py | 2 +- jupyterlab_sql_editor/ipython_magic/trino/trino.py | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jupyterlab_sql_editor/ipython_magic/sparksql/sparksql.py b/jupyterlab_sql_editor/ipython_magic/sparksql/sparksql.py index 5ba8790..11bba9b 100644 --- a/jupyterlab_sql_editor/ipython_magic/sparksql/sparksql.py +++ b/jupyterlab_sql_editor/ipython_magic/sparksql/sparksql.py @@ -279,7 +279,7 @@ def sparksql(self, line=None, cell=None, local_ns=None): self.cached_limit = limit self.cached_df = df self.cached_results = results - self.cached_pdf = pdf + self.cached_pdf = pdf.copy() if pdf is not None else None display_df( original_df=df, diff --git a/jupyterlab_sql_editor/ipython_magic/trino/trino.py b/jupyterlab_sql_editor/ipython_magic/trino/trino.py index 4ecb603..cf3f2a0 100644 --- a/jupyterlab_sql_editor/ipython_magic/trino/trino.py +++ b/jupyterlab_sql_editor/ipython_magic/trino/trino.py @@ -238,7 +238,7 @@ def trino(self, line=None, cell=None, local_ns=None): # Cache results self.cached_sql = sql - self.cached_pdf = pdf + self.cached_pdf = pdf.copy() if pdf is not None else None _display_results( pdf=pdf if pdf is not None else pd.DataFrame([]), diff --git a/package.json b/package.json index 92d40f8..ce95a55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jupyterlab-sql-editor", - "version": "1.1.2", + "version": "1.1.3", "description": "SQL editor support for formatting, syntax highlighting and code completion of SQL in cell magic, line magic, python string and file editor.", "keywords": [ "jupyter",