Skip to content

Instantly share code, notes, and snippets.

View public-daniel's full-sized avatar

Public Daniel public-daniel

View GitHub Profile
@public-daniel
public-daniel / create_entity.sql
Last active April 28, 2021 17:14
History Tables in SQL
CREATE TABLE entity (
id INTEGER NOT NULL AUTO_INCREMENT
,createdDate TIMESTAMP NOT NULL
,createdBy INTEGER NOT NULL
,deletedDate TIMESTAMP NULL
,status VARCHAR(50) NOT NULL
,ownerId INTEGER NOT NULL -- Foreign key to user that currently owns entity
,companyId INTEGER NOT NULL -- Foreign key to company that owns entity... never changes
)
DROP TABLE IF EXISTS jobs_history;
CREATE TABLE jobs_history
(
id INTEGER IDENTITY(1, 1) PRIMARY KEY,
jobId INTEGER NOT NULL,
valid_from TIMESTAMP NOT NULL,
valid_to TIMESTAMP NULL,
type VARCHAR(50),
status VARCHAR(50),
@public-daniel
public-daniel / main.py
Last active November 11, 2020 16:58
Few ideas for Greg on ML serving with FastAPI
from datetime import datetime
from enum import Enum
import time
from typing import Optional
from uuid import UUID, uuid4
from fastapi import BackgroundTasks, FastAPI, Request
from pydantic import BaseModel, Field