mirror of
https://github.com/maubot/maubot
synced 2025-08-28 20:30:38 +00:00
19 lines
572 B
Python
19 lines
572 B
Python
try:
|
|
from sqlalchemy import MetaData, asc, create_engine, desc
|
|
from sqlalchemy.engine import Engine
|
|
from sqlalchemy.exc import IntegrityError, OperationalError
|
|
except ImportError:
|
|
|
|
class FakeError(Exception):
|
|
pass
|
|
|
|
class FakeType:
|
|
def __init__(self, *args, **kwargs):
|
|
raise Exception("SQLAlchemy is not installed")
|
|
|
|
def create_engine(*args, **kwargs):
|
|
raise Exception("SQLAlchemy is not installed")
|
|
|
|
MetaData = Engine = FakeType
|
|
IntegrityError = OperationalError = FakeError
|
|
asc = desc = lambda a: a
|