You will notice that the SQLModel example is very similar to the SQLAlchemy example for fastapi-users. This is because SQLModel is built on top of SQLAlchemy and pydantic.
There are a few important differences you should take note of:
""" | |
Epic OAuth2 Client | |
""" | |
from __future__ import annotations | |
import datetime | |
import logging | |
import os | |
import pathlib |
""" | |
Organization | |
https://www.hl7.org/fhir/organization.html | |
""" | |
import os | |
from typing import Type, TypeVar | |
import uvicorn |
import os | |
from datetime import datetime, timezone | |
from pathlib import Path | |
import openai | |
import rich.traceback | |
from prompt_toolkit import PromptSession | |
from prompt_toolkit.history import FileHistory | |
from rich.console import Console | |
from rich.live import Live |
from typing import Literal, TypedDict | |
DENSE_CALCIUM_VOLUME: Literal["denseCalciumVolume"] = "denseCalciumVolume" | |
FATTY_FIBROUS_VOLUME: Literal["fattyFibrousVolume"] = "fattyFibrousVolume" | |
TOTAL_CALCIFIED_PLAQUE_VOLUME = "totalCalcifiedPlaqueVolume" | |
class TypedCleerlyDict(TypedDict): | |
denseCalciumVolume: float | |
fattyFibrousVolume: float |
You will notice that the SQLModel example is very similar to the SQLAlchemy example for fastapi-users. This is because SQLModel is built on top of SQLAlchemy and pydantic.
There are a few important differences you should take note of:
#!/usr/bin/env python3 | |
""" | |
AWS Profile Rotation Script | |
""" | |
import argparse | |
import configparser | |
import pathlib | |
from copy import deepcopy |
""" | |
Extending the SimpleNamespace Class | |
""" | |
import datetime | |
from functools import singledispatch | |
from types import SimpleNamespace | |
from typing import Any | |
""" | |
Custom JSON Encoding | |
Thanks Pydantic! https://github.com/samuelcolvin/pydantic/blob/master/pydantic/json.py | |
""" | |
from collections import deque | |
from dataclasses import asdict, is_dataclass | |
import datetime | |
from decimal import Decimal |
""" | |
Reproducible Cohorting for Experiments | |
""" | |
import hashlib | |
import logging | |
from typing import Dict, Optional, Tuple | |
import numpy as np | |
from pandas import DataFrame |
#!/usr/bin/env python3 | |
# Author:: Justin Flannery (mailto:juftin@juftin.com) | |
""" | |
An Easy Script for Retrieving the Percent Through the Current Month | |
""" | |
from calendar import monthrange | |
from datetime import datetime |