Skip to content

how to use .env to connect in sqlalchemy #64

@wanghaisheng

Description

@wanghaisheng

from sqlalchemy import create_engine
import os

url = os.getenv("TURSO_DATABASE_URL")
auth_token = os.getenv("TURSO_AUTH_TOKEN")

engine = create_engine("sqlite+libsql://", echo=True)

Base.metadata.create_all(engine)

then if i set this to local db, after process how to sync to cloud like conn.sync()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions