File tree 2 files changed +23
-3
lines changed
2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
# Unreleased
2
+
3
+ ## Features
4
+ - #55 Added publicly callable function finding the database id from its name.
Original file line number Diff line number Diff line change @@ -83,9 +83,7 @@ def _get_database_id(
83
83
database_name : str ,
84
84
) -> str :
85
85
"""
86
- Finds the database id, given an optional database name. If the name is not
87
- provided returns an id of any non-deleted database. The latter option may be
88
- useful for testing.
86
+ Finds the database id, given the database name.
89
87
"""
90
88
dbs = list_databases .sync (account_id , client = client )
91
89
dbs = list (filter (lambda db : (db .name == database_name ) and # type: ignore
@@ -96,6 +94,25 @@ def _get_database_id(
96
94
return dbs [0 ].id
97
95
98
96
97
+ def get_database_id (
98
+ host : str ,
99
+ account_id : str ,
100
+ pat : str ,
101
+ database_name : str ,
102
+ ) -> str :
103
+ """
104
+ Finds the database id, given the database name.
105
+
106
+ Args:
107
+ host: SaaS service URL.
108
+ account_id: User account ID
109
+ pat: Personal Access Token.
110
+ database_name: Database name.
111
+ """
112
+ with create_saas_client (host , pat ) as client :
113
+ return _get_database_id (account_id , client , database_name )
114
+
115
+
99
116
def get_connection_params (
100
117
host : str ,
101
118
account_id : str ,
You can’t perform that action at this time.
0 commit comments