Ardilla
A simplistic sqlite python ORM with pydantic models
Install / Use
/learn @chrisdewa/ArdillaREADME
ardilla
<div style="text-align:center"> <img src="https://images-ext-2.discordapp.net/external/x805WO_foe1CtyWMNyUDl26wNryhN5MmJzBhs6JGKOU/https/repository-images.githubusercontent.com/638528340/5dec5f3d-1af7-420a-89bc-465fae9f3875?width=200&height=150" > </div>Ardilla (pronounced ahr-dee-yah) means "SQuirreL" in spanish.
This library aims to be a simple way to add an SQLite database and basic C.R.U.D. methods to python applications. It uses pydantic for data validation and supports a sync engine as well as an async (aiosqlite) version.
Who and what is this for
This library is well suited for developers seeking to incorporate SQLite into their python applications to use simple C.R.U.D. methods. It excels in its simplicity and ease of implementation while it may not be suitable for those who require more complex querying, intricate relationships or top performance.
For developers who desire more advanced features, there are other libraries available, such as tortoise-orm, sqlalchemy, pony or peewee.
Links
Find Ardilla's source code here
Documentation can be accessed here
install
Install lastest release from PyPi
pip install -U ardilla
pip install -U ardilla[async]
pip install -U ardilla[dev]
- async instaslls aiosqlite
- dev installs formatting and testing dependencies
Or install the lastest changes directly from github
pip install git+https://github.com/chrisdewa/ardilla.git
pip install git+https://github.com/chrisdewa/ardilla.git#egg=ardilla[async]
pip install git+https://github.com/chrisdewa/ardilla.git#egg=ardilla[dev]
How to use
from ardilla import Engine, Model, Crud
from pydantic import Field
class User(Model):
id: int = Field(primary=True, autoincrement=True)
name: str
age: int
def main():
with Engine('db.sqlite') as engine:
user = crud.get_or_none(id=1) # user with id of 1
user2, was_created = crud.get_or_create(id=2, name='chris', age=35)
users = crud.get_many(name='chris') # all users named chris
user3 = User(id=3, name='moni', age=35)
user.age += 1 # it's her birthday
crud.save_one(user3)
crud.save_many(user, user2, user3)
Supported CRUD methods:
crud.insertInserts a record, rises errors if there's a conflictcrud.insert_or_ignoreInserts a record or silently ignores if it already existscrud.save_oneupserts an objectcrud.save_manyupserts many objectscrud.get_allequivalent toSELECT * FROM tablenamecrud.get_manyreturns all the objects that meet criteriacrud.get_or_createreturns an tuple of the object and a bool, True if the object was newly createdcrud.get_or_noneReturns the first object meeting criteria if anycrud.delete_oneDeletes an objectcrud.delete_manyDeletes many objects
Examples:
- A simple FastAPI application
- A reputation based discord bot
- basic usage
- basic usage with foreign keys
Related Skills
feishu-drive
339.5k|
things-mac
339.5kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
339.5kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
yu-ai-agent
2.0k编程导航 2025 年 AI 开发实战新项目,基于 Spring Boot 3 + Java 21 + Spring AI 构建 AI 恋爱大师应用和 ReAct 模式自主规划智能体YuManus,覆盖 AI 大模型接入、Spring AI 核心特性、Prompt 工程和优化、RAG 检索增强、向量数据库、Tool Calling 工具调用、MCP 模型上下文协议、AI Agent 开发(Manas Java 实现)、Cursor AI 工具等核心知识。用一套教程将程序员必知必会的 AI 技术一网打尽,帮你成为 AI 时代企业的香饽饽,给你的简历和求职大幅增加竞争力。
