Skip to content

Conversation

@NHDaly
Copy link
Member

@NHDaly NHDaly commented Aug 9, 2022

Implement v2 create_database(), which drops the requirement to pass in an engine:

julia> ctx = Context(load_config())
Context("us-east", "https", "azure.relationalai.com", "443", ClientCredentials("HZON00cfTWiDZBdQkU627DpJfTPOAgjM", "OkZaHX-YuLepzV4QkCQcKjVPZI1fz3AraCBCaNvNZULcxY6Jk6pZZkzZBBhkN0AR", nothing, nothing), "https://azure.relationalai.com")

julia> create_database(ctx, "mytestdb")
JSON3.Object{Vector{UInt8}, Vector{UInt64}} with 1 entry:
  :database => {

julia> show(ans)
{
   "database": {
                  "account_name": "relationalai-team-rd-flex",
                          "name": "mytestdb",
                            "id": "494db1da-aaa6-a08d-81ae-a585abdecf56",
                         "state": "CREATED",
                        "region": "us-east",
                    "created_on": "2022-08-09T19:02:08.147Z",
                    "created_by": "HZON00cfTWiDZBdQkU627DpJfTPOAgjM@clients"
               }
}

(i really hate the way JSON objects display in julia)

But maintain backwards compatibility with the old function call, and display a DEPRECATION warning:

julia> create_database(ctx, "mytestdb", "dba-playground", overwrite=true)
┌ Warning: DEPRECATED: Passing an `engine` is no longer required for creating a database. This will be removed in a future release. Please update your call to `create_database(ctx, name)`.
└ @ RAI ~/work/rai-sdk-julia/src/api.jl:399
┌ Warning: DEPRECATED: The `overwrite` option is no longer supported for creating a database. This will be removed in a future release. Please delete an existing database before attempting to create it.
└ @ RAI ~/work/rai-sdk-julia/src/api.jl:404
JSON3.Object{Vector{UInt8}, Vector{UInt64}} with 7 entries:
  :output       => Union{}[]
  :problems     => Union{}[]
  :actions      => Union{}[]
  :debug_level  => 0
  :aborted      => false
  :type         => "TransactionResult"
  :abort_reason => nothing

The new return format is different than the old return format, but as long as you call through the old API (by passing an engine) you will still get the old return format for now.

The next release can be a breaking release that drops support for the old API call.

Fixes #57.

NHDaly added 3 commits August 9, 2022 12:56
This is a non-breaking deprecation release.

We will make the breaking change to remove the deprecated features in a
breaking version change release after this.
@NHDaly NHDaly requested review from NRHelmi and bachdavi August 9, 2022 19:37
Copy link
Member

@bachdavi bachdavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@bachdavi
Copy link
Member

Tests seem to be failing because of the @warning

@NHDaly
Copy link
Member Author

NHDaly commented Aug 11, 2022

Tests seem to be failing because of the @warning

Thanks david, you were right. It turns out trailing \ to break up a string was added only in julia 1.7! 😮 thanks!

@NHDaly NHDaly merged commit b3d12b0 into main Aug 11, 2022
@NHDaly NHDaly deleted the nhd-create-db-v2 branch August 11, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update create_database to v2 (shouldn't require an Engine to create a database)

2 participants