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).

Parameters

  • 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.

Returns

  • ClientSync - A synchronous root client. Use with connect_sync(...) as client: or client = connect_sync(...); client.close().

Referenced By

RelationalAI Documentation
├──  Build With RelationalAI
│   └──  Understand how PyRel works > Use advanced reasoning > Predictive reasoning
│       └──  Monitor training
│           └──  Manage a training job
└──  Manage the RAI Native App for Snowflake
    ├──  Manage the RelationalAI Native App for Snowflake
    │   └──  Upgrade the Native App
    │       ├──  Set the reasoner upgrade schedule
    │       ├──  View the current reasoner upgrade schedule
    │       └──  Upgrade reasoners manually
    └──  Manage reasoners
        └──  Manage reasoner jobs
            ├──  View all jobs
            ├──  Get job details
            └──  Cancel a job