This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| from typing import Any, ClassVar | |
| from flask import current_app | |
| from flask_sqlalchemy import SQLAlchemy | |
| from sqlalchemy import ColumnElement, Dialect, FunctionElement, Integer, String, TypeDecorator, func, text, type_coerce | |
| from sqlalchemy.dialects.postgresql import BYTEA, JSON, JSONB | |
| from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column | |
| from sqlalchemy.sql.operators import OperatorType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| model_to_dict() functiion for SQLAlchemy models | |
| Based on answers by "doog abides" and "daveoncode" from | |
| https://stackoverflow.com/questions/23554119/convert-sqlalchemy-orm-result-to-dict | |
| @author: Hrishikesh Terdalkar | |
| """ |