Connection¶
Depending on your database backend, you’ll need to install a different set of libraries and use a different database URL.
You can see more examples of database URLs on SQLAlchemy’s docs.
SQLite¶
$ pip install ormar[sqlite]
from nextcord_ormar import Bot
bot = Bot(command_prefix="$", database_url="sqlite:///db.sqlite")
MySQL¶
$ pip install ormar[mysql]
Ormar and SQLAlchemy use aiomysql and pymysql respectively so your
URL should start with mysql+pymysql://
from nextcord_ormar import Bot
bot = Bot(command_prefix="$", database_url="mysql+pymysql://username:password@hostname/database")
PostgreSQL¶
$ pip install ormar[mysql]
Ormar and SQLAlchemy use asyncpg and psycopg2 respectively so your
URL should start with postgresql+psycopg2://
from nextcord_ormar import Bot
bot = Bot(command_prefix="$", database_url="postgresql+psycopg2://username:password@hostname/database")