I want to access my database connections programmatically like:
from datalore.database import list_connections
connections = list_connections()
print(connections)
Or for example,
from datalore.database import DatabaseConnection
# Define a new database connection
db_connection = DatabaseConnection.create(
name="New Database",
db_type="postgresql", # Change this to match your database type (e.g., "mysql")
host="your-db-host",
port=5432, # Change the port based on your database
database="your-database-name",
user="your-username",
password="your-password"
)
# Attach the new database connection
db_connection.attach()
print(f"Connected to: {db_connection.name}")
Is this possible? I need to repeat and execute the same queries for a number of different databases. So the SQL cell is not viable and the connections are over ssh.