File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def __init__(
78
78
protocol = protocol if protocol else "grpc"
79
79
self .endpoint = f"{ protocol } ://{ host } :{ port } "
80
80
self .credentials = prepare_credentials (credentials )
81
- self .database = database
81
+ self .database = self . _maybe_add_slash ( database )
82
82
self .table_path_prefix = ydb_table_path_prefix
83
83
84
84
self .connection_kwargs : dict = kwargs
@@ -161,6 +161,15 @@ def _get_client_settings(self) -> ydb.QueryClientSettings:
161
161
.with_native_json_in_result_sets (False )
162
162
)
163
163
164
+ def _maybe_add_slash (self , database : str ) -> str :
165
+ if not database :
166
+ return database
167
+
168
+ if database .startswith ("/" ):
169
+ return database
170
+
171
+ return f"/{ database } "
172
+
164
173
165
174
class Connection (BaseConnection ):
166
175
_driver_cls = ydb .Driver
You can’t perform that action at this time.
0 commit comments