RelationalAI / rai-sdk-python

The RelationalAI Software Development Kit (SDK) for Python.
Apache License 2.0
17 stars 4 forks source link

add profile flag to ./delete_database.py #70

Closed salamehsameera closed 2 years ago

salamehsameera commented 2 years ago

Simple PR to add -profile option when deleting the database

larf311 commented 2 years ago

Why is this needed and what does it do? Do we want to expose this to end users?

salamehsameera commented 2 years ago

@larf311 this is a flag to specify the profile in the configuration file. For instance, you can have two different profiles in your ~/.rai/config file, one pointing to a dev env and the other to local setup, and you can specify which one to use when using the SDK by specifying the -p option. For example: python ./delete_database ss-test-db -p dev1, with this in the config file

[dev1]
region = us-east
host = azure-dev1.relationalai.com
scheme = https
infra = AZURE
access_key = ..
private_key_filename = ..

[local]
region = us-east
host = 127.0.0.1
port = 8082
scheme = http
infra = AZURE
access_key = ..
private_key_filename = ..

Without this option, we're gonna have to always mark a profile with the tag default when it's needed. To run the same example as the above one: python ./delete_database ss-test-db, with this in the config file:

[default]
region = us-east
host = azure-dev1.relationalai.com
scheme = https
infra = AZURE
access_key = ..
private_key_filename = ..

[local]
region = us-east
host = 127.0.0.1
port = 8082
scheme = http
infra = AZURE
access_key = ..
private_key_filename = ..

The difference is the tag default instead of dev1 in the first example. This makes life harder when switching environments. Not sure about exposing it to end users, it's fairly used in most files like run_query and create_database.

larf311 commented 2 years ago

Yeah, makes sense. 👍