Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DX] print out SQLite database path in dev mode #8830

Merged
merged 4 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/syft/src/syft/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ def __init__(

use_sqlite = local_db or (processes > 0 and not is_subprocess)
document_store_config = document_store_config or self.get_default_store(
use_sqlite=use_sqlite
use_sqlite=use_sqlite,
store_type="Document Store",
)
action_store_config = action_store_config or self.get_default_store(
use_sqlite=use_sqlite
use_sqlite=use_sqlite,
store_type="Action Store",
)
self.init_stores(
action_store_config=action_store_config,
Expand Down Expand Up @@ -434,12 +436,15 @@ def runs_in_docker(self) -> bool:
and any("docker" in line for line in open(path))
)

def get_default_store(self, use_sqlite: bool) -> StoreConfig:
def get_default_store(self, use_sqlite: bool, store_type: str) -> StoreConfig:
if use_sqlite:
path = self.get_temp_dir("db")
file_name: str = f"{self.id}.sqlite"
if self.dev_mode:
print(f"{store_type}'s SQLite DB path: {path/file_name}")
return SQLiteStoreConfig(
client_config=SQLiteStoreClientConfig(
filename=f"{self.id}.sqlite",
filename=file_name,
path=path,
)
)
Expand Down
Loading