Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Latest commit

 

History

History
72 lines (62 loc) · 1.67 KB

database_url_format.md

File metadata and controls

72 lines (62 loc) · 1.67 KB

SQL Database URL formats for SQLAlchemy

SQLITE

  • Synchronous
    • sqlite:///database_path
      • Example sqlite:///./sql_app.db
  • Asynchronous
    • Install aiosqlite
      • Poetry
        poetry add aiosqlite
        
      • Pip
        pip install aiosqlite
        
    • sqlite+aiosqlite:///database_name.sqlite

MySQL & Maria DB

  • Install aiomysql, which will also install pymysql
    • Poetry
      poetry add aiomysql
      
    • Pip
      pip install aiomysql
      
    • Not all versions of pymysql work correctly with aiomysql, that's why we installed aiomysql before pymysql.
  • Synchronous
    • mysql+pymysql://username:password@host:port/database_name
  • Asynchronous
    • mysql+aiomysql://username:password@host:port/database_name

PostgreSQL

  • Install asyncpg
    • Poetry
      poetry add asyncpg
      
    • Pip
      pip install asyncpg
      
  • Synchronous
    • postgresql://username:password@host:port/database_name
  • Asynchronous
    • postgresql+asyncpg://username:password@host:port/database_name

Oracle

  • Install cx-Oracle-async
    • Poetry
      poetry add cx-Oracle-async
      
    • Pip
      pip install cx-Oracle-async
      
  • Synchronous
    • oracle://username:password@host:port/sidname
  • Asynchronous
    • oracle+cx_Oracle_async://username:password@database_name

Others

Check out other database drivers from this link