Skip to content

Python API Release Notes

1.23.1

Python SDK


Version 1.23.1 of the relationalai Python package is now available!

To upgrade, activate your virtual environment and run the following command:

pip install --upgrade relationalai

New Features and Enhancements

  • A new project you create with rai models init now deploys to Snowflake without you having to add a refresh schedule by hand. Before this release, rai models deploy failed on a brand-new project with an Unscheduled Outputs error, because the generated raiconfig.yaml didn't say how often to refresh the deployed tables and views. The config now includes a default refresh schedule with interval_s: 0, which refreshes the outputs each time you deploy but not on a fixed interval, so the deploy succeeds.

Bug Fixes

  • If you haven't filled in your Snowflake connection details yet, PyRel now stops with a clear error message naming the values you need to fill in, instead of a confusing raw Snowflake error. For example, a new project's raiconfig.yaml might still have the placeholder account: myorg-myaccount. PyRel runs this check the first time it opens a Snowflake connection, so you see the message early, whether you run a script, run a query, or deploy your model.

  • The rai debugger can now open the logs from large programs without freezing. The debugger also has a new Collapse all button that closes every open section at once, and opening one section no longer expands the other sections with the same name.

  • Pulling or merging a shared model now correctly rebuilds models that earlier releases could rebuild incorrectly. When you run rai models pull or rai models merge, PyRel regenerates the shared model's code from your team's changes. Before this release, pull and merging a shared a model could sometimes result in models that failed to build.

  • You can now call solve() again on the same prescriptive Problem while asking for fewer of its optional sensitivity and conflict results. Before this release, re-solving without a sensitivity or conflict result you had requested earlier raised an error. Now the re-solve succeeds. On current RelationalAI platform versions, it also clears the results you no longer request, so you don't see stale numbers from an earlier solve. You still can't switch between a plain solve and a sensitivity or conflict solve on the same Problem. Create a new Problem for that.

1.23.0

Python SDK


Version 1.23.0 of the relationalai Python package is now available!

To upgrade, activate your virtual environment and run the following command:

pip install --upgrade relationalai

New Features and Enhancements

  • You can now keep the capitalization of your column names when you deploy a model to Snowflake. By default, PyRel converts unquoted column names to all upper case, so a property named EntityId deploys as the column ENTITYID. To keep the case you declared instead, set preserve_column_case: true in the deployment section of your raiconfig.yaml (DeploymentConfig):

    deployment:
      preserve_column_case: true   # default: false
    

    This applies to column names only, not table names. With the option on, PyRel quotes the columns, so the names become case-sensitive in Snowflake. Query them with the exact case and quotes, such as "EntityId".

  • You can now name a relationship field that holds more than one kind of entity using the pipe operator | or the union() function. This is useful when a field can point to instances of different concepts, such as an account owned by either an Individual or an Organization:

    Account.owner = m.Relationship(f"{Account} owned by {(Individual | Organization):owner}")
    # equivalently:
    Account.owner = m.Relationship(f"{Account} owned by {union(Individual, Organization):owner}")
    

    Each option must be a concrete entity type, such as Individual or Organization, rather than a value type like a number or string. A union must list at least two.

Bug Fixes

  • Fixed a bug that caused some model deployments to fail with a NotImplementedError and produce incomplete output tables.

  • Fixed a bug that caused the refresh task for some deployed models to fail with a Snowflake error or to produce empty tables.

  • Fixed queries that read two fields from the same multi-field Property in one select(), such as select(invoice.total["currency"], invoice.total["amount"]), when invoice comes from a nested select() that returns more than one invoice.

    Before 1.23.0, PyRel could mix rows across invoices, returning every invoice's field values for each invoice instead of only its own. Now each invoice returns only its own values. This bug only affected Property instances, not Relationship instances, which always return the stored pairs correctly.

    # `invoice` comes from an inner select(), then an outer select() reads
    # two fields of the same multi-field property:
    invoice = model.where(Invoice.overdue).select(Invoice)[0]
    model.select(invoice.total["currency"], invoice.total["amount"])
    
  • rai models pull no longer blocks a pull just because your branch has its own local changes. Before this release, PyRel could mistake those local changes for a conflict and block the pull. Now a pull is blocked only when your changes actually conflict with the shared history.

1.22.0

Python SDK


Version 1.22.0 of the relationalai Python package is now available!

To upgrade, activate your virtual environment and run the following command:

pip install --upgrade relationalai

New Features and Enhancements

  • You can now share your Snowflake connections, and other settings, across projects instead of copying them into every project's raiconfig.yaml. PyRel now discovers a home-level ~/.rai/raiconfig.yaml configuration file and merges it with each project's raiconfig.yaml, so you define shared settings once. Previously, a project file that only named a shared connection (default_connection: my_conn) failed, because PyRel couldn't find where that connection was defined.

    For example, define a connection once in the home file, then reference it by name from any project:

    # ~/.rai/raiconfig.yaml — define the connection once
    connections:
      my_conn:
        account: MY_ACCOUNT
        user: MY_USER
        role: MY_ROLE
        warehouse: MY_WH
    default_connection: my_conn
    
    # raiconfig.yaml — in a project; no connection details needed here
    default_connection: my_conn
    

    Anything you set in a project file still wins, so per-project overrides keep working. Not sure where a setting is coming from? Run rai config:explain to trace each value to its file.

  • You can now deploy a model from Python code by passing a config to Model, instead of deploying from a raiconfig.yaml file. For those deploys, the rai doctor report troubleshooting report is now accurate. Before this release, it could show parts of your deployment as missing. Now it reflects the configuration your deploy actually used.

Bug Fixes

  • Improved performance for queries against deployed models that compute several aggregates grouped by the same key with per. Before this release, PyRel compiled these queries to SQL that repeated the same grouping join far more times than needed, so they ran slower while still returning correct results. Now the generated SQL is much smaller and runs faster.

  • Fixed how PyRel references a Snowflake database, schema, or table used as a data source whose quoted name contains a period, such as a table named "CoNNec.tioNs". Before this release, PyRel split the name on every period and produced an incorrect table reference. Now it keeps the quoted name intact.

1.21.4

Python SDK


Version 1.21.4 of the relationalai Python package is now available!

To upgrade, activate your virtual environment and run the following command:

pip install --upgrade relationalai

New Features and Enhancements

  • Deployed models now refresh more efficiently when a concept declares primary keys with identify_by. Before this release, PyRel always added a hashed _ID key column to deployed concept tables and joined on it. Now it uses the declared key columns directly, so each refresh does less work and returns the same results.

Bug Fixes

  • Fixed a correctness problem in deployed models where you identify a concept by a source column whose values can repeat, such as an Order identified by an order id that appears on many line-item rows. Before this release, that concept's deployed table could contain duplicate rows for the same Order, so some queries over it could return wrong results. The table now keeps one row per entity, so those queries return correct results.

  • Fixed Model.Table] so that you can access Snowflake source columns whose names contain spaces. Before this release, accessing such a column by the name you declared (for example, orders["customer id"]) raised a KeyError even though the column existed. Now it resolves to that column.

1.21.3

Python SDK


Version 1.21.3 of the relationalai Python package is now available!

To upgrade, activate your virtual environment and run the following command:

pip install --upgrade relationalai

New Features and Enhancements

  • Improved deployed model refresh performance for models with a concept whose identity comes from columns in more than one table. Before this release, if that concept had several properties, PyRel re-read and re-joined those tables once for every property on each refresh, which was slow over large tables. Now PyRel reads and joins them once and fills in all the concept's properties from a single pass, so each refresh does less repeated work and returns the same results.

  • Improved status reporting for the REFRESH_STATUS procedure.