Skip to content

Releases: posit-dev/posit-sdk-py

v0.5.0

19 Sep 11:31
0614ae4
Compare
Choose a tag to compare

What's Changed

Breaking Changes

  • The positional argument order of posit.connect.external.PositCredentialsStrategy has changed in #268

New Contributors

Full Changelog: v0.4.0...v0.5.0

v0.4.0

07 Aug 18:00
37bc1dc
Compare
Choose a tag to compare

What's Changed

  • refactor!: apply flake8 builtin rules by @tdstein in #248
  • feat: replace restart environment variable hash with Unix epoch by @tdstein in #251
  • feat!: improve compatibility with Databricks SQL client by @dbkegley in #252

Breaking Changes

  • refactor: rename bundles.create method argument from input to archive by @tdstein in #248
  • refactor: rename bundles.get method argument from id to uid by @tdstein in #248
  • refactor: rename permissions.get method argument from id to uid by @tdstein in #248
  • refactor: rename tasks.get method argument from id to uid by @tdstein in #248
  • refactor: rewrite external.databricks helpers for better interop between databricks-sdk-python and databricks-sql-python by @dbkegley #252

Migration Guide

This release includes changes to remove shadowing of builtins. As a result, the argument names for various methods have changed. This change only impacts method invocations using keyword-arguments. Methods invoked without keyword-arguments do not require adjustments.

refactor: rename bundles.create method argument from input to archive by @tdstein in #248

Rename the keyword-argument input to archive.

Previous

from posit import connect

client = connect.Client()
content = client.content.find_one()
bundle = content.bundles.create(input="archive.tar.gz")

Current

from posit import connect

client = connect.Client()
content = client.content.find_one()
bundle = content.bundles.create(archive="archive.tar.gz")

refactor: rename bundles.get method argument from id to uid by @tdstein in #248

Rename the keyword-argument id to uid.

Previous

from posit import connect

client = connect.Client()
content = client.content.find_one()
bundle = content.bundles.get(id="3bb97e21-8216-445c-95b7-288578ca4311")

Current

from posit import connect

client = connect.Client()
content = client.content.find_one()
bundle = content.bundles.get(uid="3bb97e21-8216-445c-95b7-288578ca4311")

refactor: rename permissions.get method argument from id to uid by @tdstein in #248

Rename the keyword-argument id to uid.

Previous

from posit import connect

client = connect.Client()
content = client.content.find_one()
permission = content.permissions.get(id="3bb97e21-8216-445c-95b7-288578ca4311")

Current

from posit import connect

client = connect.Client()
content = client.content.find_one()
permission = content.permissions.get(uid="3bb97e21-8216-445c-95b7-288578ca4311")

refactor: rename tasks.get method argument from id to uid by @tdstein in #248

Rename the keyword-argument id to uid.

Previous

from posit import connect

client = connect.Client()
task = client.tasks.get(id="CmsfmnfDDyRUrsAc")

Current

from posit import connect

client = connect.Client()
task = client.tasks.get(uid="CmsfmnfDDyRUrsAc")

refactor: rewrite external.databricks helpers for better interop between databricks-sdk-python and databricks-sql-python by @dbkegley #252

Previous

from databricks import sql
from databricks.sdk.core import ApiClient, Config
from databricks.sdk.service.iam import CurrentUserAPI
from posit.connect.external.databricks import viewer_credentials_provider

session_token = "<read-from-http-header>"
credentials_provider = viewer_credentials_provider(
    user_session_token=session_token
)

# databricks-sdk usage
cfg = Config(
    host=DATABRICKS_HOST_URL,
    credentials_provider=credentials_provider
)
databricks_user = CurrentUserAPI(ApiClient(cfg)).me()
print(databricks_user)

# databricks-sql usage
with sql.connect(
    server_hostname=DATABRICKS_HOST,
    http_path=SQL_HTTP_PATH,
    auth_type="databricks-oauth", # old local credential_provider fallback behavior
    credentials_provider=credentials_provider,
) as connection:
    with connection.cursor() as cursor:
        cursor.execute("SELECT * FROM samples.nyctaxi.trips LIMIT 10;")
        result = cursor.fetchall()
        print(result)

Current

Warning

Requires databricks-sdk>=0.29.0

from databricks import sql
from databricks.sdk.core import ApiClient, Config, databricks_cli
from databricks.sdk.service.iam import CurrentUserAPI
from posit.connect.external.databricks import PositCredentialsStrategy

session_token = "<read-from-http-header>"
posit_strategy = PositCredentialsStrategy(
    local_strategy=databricks_cli, # new local credential_provider fallback behavior
    user_session_token=session_token)
cfg = Config(
    host=DATABRICKS_HOST_URL,
    # uses Posit's custom credential_strategy if running on Connect,
    # otherwise falls back to the strategy defined by local_strategy
    credentials_strategy=posit_strategy)

databricks_user = CurrentUserAPI(ApiClient(cfg)).me()
print(databricks_user)

with sql.connect(
    server_hostname=DATABRICKS_HOST,
    http_path=SQL_HTTP_PATH,
    # https://github.com/databricks/databricks-sql-python/issues/148#issuecomment-2271561365
    credentials_provider=posit_strategy.sql_credentials_provider(cfg)
) as connection:
    with connection.cursor() as cursor:
        cursor.execute("SELECT * FROM samples.nyctaxi.trips LIMIT 10;")
        result = cursor.fetchall()
        print(result)

Full Changelog: v0.3.1...v0.4.0

v0.3.1

29 Jul 17:43
046ace7
Compare
Choose a tag to compare

What's Changed

  • feat: content render and restart by @tdstein in #236
  • feat: add the payload to ClientError and structure message by @tdstein in #242
  • feat: add content type helpers by @tdstein in #243

Full Changelog: v0.3.0...v0.3.1

v0.3.0

11 Jul 17:02
114ecb7
Compare
Choose a tag to compare

What's Changed

  • feat: get content for user by @tdstein in #226
  • feat!: accept positional arguments when creating a client by @tdstein in #231

Full Changelog: v0.2.2...v0.3.0

v0.2.2

25 Jun 14:49
6ce4066
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.2.1...v0.2.2

v0.2.1

12 Jun 14:20
324740f
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.0...v0.2.1

v0.2.0

29 Apr 16:20
62ff359
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.1.0...v0.2.0

v0.1.0

26 Mar 15:19
49bf017
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/posit-dev/posit-sdk-py/commits/v0.1.0