mirror of
https://git.wownero.com/wownero/wownero-funding-system.git
synced 2024-08-15 00:53:45 +00:00
18 lines
634 B
Python
18 lines
634 B
Python
from datetime import datetime
|
|
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.orm import scoped_session, sessionmaker, relationship
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
import settings
|
|
|
|
|
|
def create_session():
|
|
from wowfunding.orm.orm import base
|
|
engine = sa.create_engine(settings.SQLALCHEMY_DATABASE_URI, echo=False, encoding="latin")
|
|
session = scoped_session(sessionmaker(autocommit=False,
|
|
autoflush=False,
|
|
bind=engine))
|
|
base.query = session.query_property()
|
|
base.metadata.create_all(bind=engine)
|
|
return session
|