Skip to content

Conversation

ptiurin
Copy link
Contributor

@ptiurin ptiurin commented Aug 5, 2025

Change caching to include system engine, database and user engine. This also changes the key to be in line with our new caching design - id + secret + account.
In addition, this change added caching hit tracking by using ID.

Key changes include:

Caching System and Connection Management:

  • Introduced a new caching mechanism (ConnectionInfo, EngineInfo, DatabaseInfo, SecureCacheKey) to store system engine, engine, and database info per connection, replacing the previous global cache. This enables per-connection context caching and improves performance for repeated context switches. (src/firebolt/async_db/connection.py)
  • Modified the Connection class to include a unique id for each connection instance, used as a key in the cache. (src/firebolt/async_db/connection.py [1] [2]

Authentication Refactoring:

  • Added principal and secret properties to all authentication classes, standardizing how credentials are accessed for caching and tracking purposes.

Cursor Enhancements:

  • Added use_database and use_engine methods to the cursor, supporting context switching with optional cache usage. These methods now check the cache before executing context switch queries, reducing unnecessary round-trips. (src/firebolt/async_db/cursor.py src/firebolt/async_db/cursor.pyR336-R370)

@ptiurin ptiurin changed the title Improve caching feat(FIR-46254): Extend caching Aug 6, 2025
@ptiurin ptiurin marked this pull request as ready for review August 7, 2025 10:57
@ptiurin ptiurin requested a review from a team as a code owner August 7, 2025 10:57
Copy link

@ptiurin ptiurin merged commit fcab0fc into main Aug 12, 2025
17 checks passed
@ptiurin ptiurin deleted the improve-caching branch August 12, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants