Skip to content

Instantly share code, notes, and snippets.

@michaeltoohig
michaeltoohig / gym.py
Created September 28, 2021 23:03 — forked from Alir3z4/gym.py
import os
import pickle
import warnings
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
@michaeltoohig
michaeltoohig / README.md
Last active March 4, 2022 10:24
SQLAlchemy-Continuum plugin for FastAPI with FastAPI-Users and async SQLAlchemy

The files here are the "full example" from the FastAPI-Users documenation plus some modifications for async SQLAlchemy 1.4 (maybe also 2.0?). All together it produces a simple example of using SQLAlchemy-Continuum with the transaction table having a relationship to the user.

But for most users I think the plugin.py, middleware.py and users.py files gives the basic gist of what is needed to use FastAPI with SQLAlchemy-Continuum.

EDIT: it appears less than two weeks ago an update to FastAPI may make all of the issues I was facing moot. https://github.com/tiangolo/fastapi/releases/tag/0.74.1 Keep an eye on newer versions of FastAPI and see if this gist is relevant to you in the future.

file tree

import uuid
import random
from pathlib import Path
def make_file(path: Path):
file_name = str(uuid.uuid4().hex)
new_path = path / file_name
new_path.touch()
if random.random() > 0.95: