Cached query results #87
-
I noticed that when re-querying a redshift table (with the same connection and query) that I receive the same result set, even when new data has been added to the table. Based on the query written, I would expect the result set to increase in size when the query is sent at a later time. This occurred when using pandas.read_sql() passing a redshift_connector connection object as well as opening a cursor from a redshift_connector connection object. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @binzabinza , Thank you for reporting this issue, we will look into this behavior. Could you provide us with the version of redshift_connector you are using as well as a code snippet reproducing this issue? From your description it sounds like the Redshift table is being modified by some outside process (i.e. not by redshift_connector). Is this assumption correct? |
Beta Was this translation helpful? Give feedback.
-
Thank you for these additional details, @binzabinza .
An example table (i.e. With that said, I'm wondering if this behavior is seen when directly using the redshift_connector library. If it is not apparent then, my guess would be that there is something going wrong during this integration with the other tools. If it's directly apparent with redshift_connector than it should be a bit easier to target the root cause :). |
Beta Was this translation helpful? Give feedback.
-
Default transaction isolation level is See Issue #88 |
Beta Was this translation helpful? Give feedback.
Default transaction isolation level is
REPEATABLE READ
which will return the same results for all queries in a single transaction even when a different transaction has changed the underlying data. Many people (like myself) might expect the behavior to be that of transaction isolation levelREAD COMMITTED
which will always reflect committed transactions to the table. By setting autocommit=True (or by manually committing after every select) you will guarantee that each select is the end of a transaction and that each new select is a new transaction. This will give the expectedREAD COMMITTED
behavior.See Issue #88