Skip to content

Commit 97f4e53

Browse files
committed
Fix mongosh and data api port
1 parent 46072d9 commit 97f4e53

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

docs/src/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,9 @@ context manager to automatically shut down your connection.
415415
SingleStoreDB.connect
416416
SingleStoreDB.connection_url
417417
SingleStoreDB.http_connection_url
418+
SingleStoreDB.kai_url
418419
SingleStoreDB.open_shell
420+
SingleStoreDB.open_mongosh
419421
SingleStoreDB.stop
420422

421423

singlestoredb/server/free_tier.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class SingleStoreDB:
4444
password: str
4545
kai_enabled: bool
4646
server_port: int
47-
studio_port: int
4847
data_api_port: int
4948
kai_port: Optional[int]
5049

@@ -64,8 +63,7 @@ def __init__(self) -> None:
6463
self.kai_enabled = True
6564
self.kai_port = 27017
6665
self.server_port = 3333
67-
self.studio_port = 8000
68-
self.data_api_port = 3334
66+
self.data_api_port = 443
6967
self.user = d['user']
7068
self.password = d['password']
7169
self._database = d['databaseName']
@@ -152,9 +150,11 @@ def kai_url(self) -> Optional[str]:
152150
if not self.kai_enabled:
153151
return None
154152
password = urllib.parse.quote_plus(self.password)
155-
return f'mongodb://{self.user}:{password}@' + \
156-
f'{self._endpoint}:{self.kai_port}/' + \
157-
'?authMechanism=PLAIN&tls=true&loadBalanced=true'
153+
endpoint = self._endpoint.replace('shared-dml', 'shared-mongo')
154+
return f'mongodb://{self.user}^{self._database}:{password}@' + \
155+
f'{endpoint}:{self.kai_port}/' + \
156+
'?authMechanism=PLAIN&tls=true&loadBalanced=true' + \
157+
f'&dbName={self._database}'
158158

159159
def connect_kai(self) -> 'pymongo.MongoClient':
160160
"""Connect to the Kai (MongoDB) server."""
@@ -164,20 +164,6 @@ def connect_kai(self) -> 'pymongo.MongoClient':
164164
raise RuntimeError('pymongo is not installed')
165165
return pymongo.MongoClient(self.kai_url)
166166

167-
@property
168-
def studio_url(self) -> str:
169-
"""URL for the SingleStoreDB Studio."""
170-
return f'https://{self._endpoint}:{self.studio_port}'
171-
172-
def open_studio(self) -> None:
173-
"""Open the SingleStoreDB Studio in a web browser."""
174-
import webbrowser
175-
if platform.platform().lower().startswith('macos'):
176-
chrome_path = r'open -a /Applications/Google\ Chrome.app %s'
177-
webbrowser.get(chrome_path).open(self.studio_url, new=2)
178-
else:
179-
webbrowser.open(self.studio_url, new=2)
180-
181167
def open_shell(self) -> None:
182168
"""Open a shell in the SingleStoreDB server."""
183169
if platform.platform().lower().startswith('macos'):

0 commit comments

Comments
 (0)