Connecting to a database in Python
Install the package for PostgreSQL (pip install alphadb-postgres) and import the database class.
from alphadb import AlphaDBInitialize an instance and connect it to a database using your database credentials.
db = AlphaDB()
db.connect(
host="localhost",
user="user",
password="password",
database="database",
port=5432,
)Using MySQL? Install alphadb-mysql instead. The import stays the same, and port defaults to 3306.
Replace the credentials with your own. AlphaDB requires the user to have the following privileges: CREATE, INSERT, DELETE, SELECT, UPDATE, ALTER, DROP and REFERENCES.
Last updated on