Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.62 KB

steampipe_service_db_connections.md

File metadata and controls

32 lines (26 loc) · 1.62 KB

Queries that need to be executed over a client connection:

  • Get scan metadata
    • read automatically if --timing is enabled
  • Set search path
    • Can be automatically during session startup
    • Can be set by the user using meta commands
  • Cache commands
    • Can be automatically during session startup
    • Can be set by the user using meta commands
  • Introspection tables
    • Written automatically for each database connection
    • Read by system if --tag or --where are used for check

Database Session

A thin wrapper around the raw database connection which caches the search path and the scan metadata id

Acquire session

  1. Get a database connection from the pool
  2. if not found in session cache map
    1. create a DatabaseSession for the connection
    2. Persist DatabaseSession in session cache map
  3. Set cache parameters (if required)
    1. If client cache is enabled, enable client cache on the connection
    2. If client cache ttl is set, set the cache ttl on the connection
  4. Ensure search path
    1. Load the search path of the steampipe user - db query
    2. Get the resolved search path based on the search_path and search_path_prefix configs (custom_search_path)
    3. if the loaded search path and resolved search path differ, set the resolved search path on the connection