Skip to content

how to use .env to connect in sqlalchemy #64

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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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