Skip to content

connect_sync

relationalai.client
connect_sync(
*,
config: "Config | None" = None,
connection_name: str | None = None,
token: str | None = None
) -> ClientSync

Synchronous entrypoint returning a ClientSync.

Use this from synchronous code. The returned ClientSync:

  • exposes sync lifecycle (client.close() / with ...)
  • exposes synchronous service clients (e.g. client.reasoners -> ReasonersClientSync)

Transport creation is lazy: no network calls are made by connect_sync(...) itself. Transports are created on first use (SQL/HTTP/services).

This function raises if called while an event loop is already running in the current thread (use await connect(...) from async code instead).

  • config

    (‘Config | None’, default: None) - Optional config to use. When omitted, a default config is loaded.
  • connection_name

    (str | None, default: None) - Optional named connection to use from the config.
  • token

    (str | None, default: None) - Optional RAI token override.
  • ClientSync - A synchronous root client. Use with connect_sync(...) as client: or client = connect_sync(...); client.close().
RelationalAI Documentation
└──  Manage the RAI Native App for Snowflake
    ├──  Manage the RAI Native App’s SPCS Service
    │   └──  Service Management
    ├──  Manage the RAI Native App’s Compute Resources
    │   └──  Reasoner Management
    ├──  Manage Data Shared With the RAI Native App
    │   ├──  The CDC Service
    │   └──  Data Stream Management
    └──  Upgrade the RAI Native App
        ├──  Automatic Upgrades
        └──  Manual Reasoner Upgrades