SlideShare a Scribd company logo
1 of 15
Download to read offline
Rust ORMs
@jayvdb
:: butane
2
ORM: Benefits
●
Database vendor abstraction
– Developers don’t need to know
the intricacies of the database
●
Multiple database support
●
Auto-generation of migrations
Rust ORMs
3
ORM: Benefits
●
Column safety
●
Type safety
●
Foundation of MVC, and any
other architectural pattern
that has a “model”
Rust ORMs
4
ORM: Negatives
●
Another leaky abstraction
●
Another dependency
– Bugs, nuances, security issues
●
Another thing to learn
Rust ORMs
5
ORM: Gold standard
●
Django - 107 years of effort (COCOMO) – 17 years
old
●
Ruby on Rails – 104 years of effort - 18 years old
– Grails (Groovy) – 205 years of effort – 18 years old
●
Meteor-js - 59 years of effort – 11 years old
●
Symfony - 284 years of effort – 17 years old
●
Hibernate – 230 years of effort – 21 years old
6
ORM: Older products
●
Drupal - 22 years old
●
ASP.NET – 20 years old
●
J2EE
– c.f. Hibernate
– Enterprise JavaBeans – 25 years old
●
WebObjects – 1996-2008 – 12 years
7
Rust ORM: Must have
●
DQL & DML
– Insert, for all data-types used in the schema
– Update, …
– Query, …
●
Actively maintained
●
Transaction support
8
Rust ORM: Nice to have
●
Upsert
– More efficient than alt.: query+insert+update
●
PostgreSQL support
●
Sqlite support
– Very handy for light-weight tests
●
DDL/Migration management
– Another tool can be used for this
●
JSON support
9
Rust ORMs: Popular (>1k*)
●
Diesel - 18 years of effort – 8 years old
●
Sea-ORM – 9 years of effort – 2 years old
●
Rbatis – 7 years of effort – 3 years old
Rust database framework
●
sqlx - 2 years of effort – 10 years old
10
Rust ORMs: Obscure
●
Ormx – 1 year of effort – 2.5 years old
●
Rustorm – 2 years of effort – 5 years old -
abandoned
●
toql - 5 years of effort – 3 years old
●
Summer-mybatis – 4 years of effort – 1 year old
●
butane - 3 years of effort – 3.5 years old
●
sprattus – 1 years of effort – 2 years old
●
Yukino-dev - 2 years of effort – 2 years old
●
Ormlite – 1 year of effort – 1 year old
●
Tql - 2 years of effort - 7 years old
11
Rust ORM: diesel
use diesel::prelude::*;
#[derive(Queryable)]
pub struct Post {
pub id: i32,
pub title: String,
pub body: String,
pub published: bool,
}
Add derives … looks simple
12
Rust ORM: diesel
diesel::table! {
posts (id) {
id -> Int4,
title -> Varchar,
body -> Text,
published -> Bool,
}
}
Except diesel needs a “schema.rs” that
defines the database fields for one database
Maybe can be generated by diesel API, and injected
using progenitor’s “post” hook.
13
Rust ORM: Sea-ORM
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel,
Deserialize, Serialize)]
#[sea_orm(table_name = "posts")]
pub struct Model {
#[sea_orm(primary_key)]
#[serde(skip_deserializing)]
pub id: i32,
pub title: String,
#[sea_orm(column_type = "Text")]
pub text: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}
Every model must be called Model
14
Rust ORM: butane
#[model]
#[derive(Clone, Debug, Default, Deserialize, PartialEq,
Serialize, ToSchema)]
pub struct Blog {
#[serde(default)]
pub posts: Many<Post>,
#[pk]
pub blog_id: uuid::Uuid,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub slug: Option<String>,
}
Requires primary keys on each model
And “Vec” need to be “butane::Many”
15
Rust ORM: butane
https://electron100.github.io/butane/getting-started
Getting started

More Related Content

Similar to butane Rust ORM

Rails automatic test driven development
Rails automatic test driven developmentRails automatic test driven development
Rails automatic test driven developmenttyler4long
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-parisJohan De Wit
 
Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)yarry
 
Java10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 SprJava10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 Sprなおき きしだ
 
Hpc to OpenStack: Our journey
Hpc to OpenStack: Our journeyHpc to OpenStack: Our journey
Hpc to OpenStack: Our journeyArif Ali
 
CRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migrationCRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migrationTomasz Rękawek
 
2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronization2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronizationfangjiafu
 

Similar to butane Rust ORM (12)

Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongodb @ vrt
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
Rails automatic test driven development
Rails automatic test driven developmentRails automatic test driven development
Rails automatic test driven development
 
Cis222 9
Cis222 9Cis222 9
Cis222 9
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
 
Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)
 
Java10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 SprJava10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 Spr
 
Hpc to OpenStack: Our journey
Hpc to OpenStack: Our journeyHpc to OpenStack: Our journey
Hpc to OpenStack: Our journey
 
CRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migrationCRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migration
 
Basic of Systemd
Basic of SystemdBasic of Systemd
Basic of Systemd
 
2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronization2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronization
 

More from John Vandenberg

Rust & Python : Python WA October meetup
Rust & Python : Python WA October meetupRust & Python : Python WA October meetup
Rust & Python : Python WA October meetupJohn Vandenberg
 
Rust & Python : Rust WA meetup 1
Rust & Python : Rust WA meetup 1Rust & Python : Rust WA meetup 1
Rust & Python : Rust WA meetup 1John Vandenberg
 
Besut Kode seminar Lampung
Besut Kode seminar LampungBesut Kode seminar Lampung
Besut Kode seminar LampungJohn Vandenberg
 
Besut Kode Seminar Malang
Besut Kode Seminar MalangBesut Kode Seminar Malang
Besut Kode Seminar MalangJohn Vandenberg
 
Wikimedia indigenous voices
Wikimedia indigenous voicesWikimedia indigenous voices
Wikimedia indigenous voicesJohn Vandenberg
 
SGU - Creating an English Wikipedia draft
SGU - Creating an English Wikipedia draftSGU - Creating an English Wikipedia draft
SGU - Creating an English Wikipedia draftJohn Vandenberg
 
SGU Wikimedia in Education overview
SGU Wikimedia in Education overviewSGU Wikimedia in Education overview
SGU Wikimedia in Education overviewJohn Vandenberg
 
SLQ Wikipedia workshop: creating a draft
SLQ Wikipedia workshop: creating a draftSLQ Wikipedia workshop: creating a draft
SLQ Wikipedia workshop: creating a draftJohn Vandenberg
 
Intelligent info 2012 wikipedia
Intelligent info 2012 wikipediaIntelligent info 2012 wikipedia
Intelligent info 2012 wikipediaJohn Vandenberg
 

More from John Vandenberg (14)

syn
synsyn
syn
 
Rust & Python : Python WA October meetup
Rust & Python : Python WA October meetupRust & Python : Python WA October meetup
Rust & Python : Python WA October meetup
 
Rust & Python : Rust WA meetup 1
Rust & Python : Rust WA meetup 1Rust & Python : Rust WA meetup 1
Rust & Python : Rust WA meetup 1
 
Besut Kode seminar Lampung
Besut Kode seminar LampungBesut Kode seminar Lampung
Besut Kode seminar Lampung
 
Besut Kode Seminar Malang
Besut Kode Seminar MalangBesut Kode Seminar Malang
Besut Kode Seminar Malang
 
Besut Kode - Workshop 2
Besut Kode - Workshop 2Besut Kode - Workshop 2
Besut Kode - Workshop 2
 
Besut Kode - Workshop 1
Besut Kode - Workshop 1Besut Kode - Workshop 1
Besut Kode - Workshop 1
 
Besut Kode Challenge 1
Besut Kode Challenge 1Besut Kode Challenge 1
Besut Kode Challenge 1
 
Wikimedia indigenous voices
Wikimedia indigenous voicesWikimedia indigenous voices
Wikimedia indigenous voices
 
SGU - Creating an English Wikipedia draft
SGU - Creating an English Wikipedia draftSGU - Creating an English Wikipedia draft
SGU - Creating an English Wikipedia draft
 
SGU Wikimedia in Education overview
SGU Wikimedia in Education overviewSGU Wikimedia in Education overview
SGU Wikimedia in Education overview
 
Commons
CommonsCommons
Commons
 
SLQ Wikipedia workshop: creating a draft
SLQ Wikipedia workshop: creating a draftSLQ Wikipedia workshop: creating a draft
SLQ Wikipedia workshop: creating a draft
 
Intelligent info 2012 wikipedia
Intelligent info 2012 wikipediaIntelligent info 2012 wikipedia
Intelligent info 2012 wikipedia
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

butane Rust ORM

  • 2. 2 ORM: Benefits ● Database vendor abstraction – Developers don’t need to know the intricacies of the database ● Multiple database support ● Auto-generation of migrations Rust ORMs
  • 3. 3 ORM: Benefits ● Column safety ● Type safety ● Foundation of MVC, and any other architectural pattern that has a “model” Rust ORMs
  • 4. 4 ORM: Negatives ● Another leaky abstraction ● Another dependency – Bugs, nuances, security issues ● Another thing to learn Rust ORMs
  • 5. 5 ORM: Gold standard ● Django - 107 years of effort (COCOMO) – 17 years old ● Ruby on Rails – 104 years of effort - 18 years old – Grails (Groovy) – 205 years of effort – 18 years old ● Meteor-js - 59 years of effort – 11 years old ● Symfony - 284 years of effort – 17 years old ● Hibernate – 230 years of effort – 21 years old
  • 6. 6 ORM: Older products ● Drupal - 22 years old ● ASP.NET – 20 years old ● J2EE – c.f. Hibernate – Enterprise JavaBeans – 25 years old ● WebObjects – 1996-2008 – 12 years
  • 7. 7 Rust ORM: Must have ● DQL & DML – Insert, for all data-types used in the schema – Update, … – Query, … ● Actively maintained ● Transaction support
  • 8. 8 Rust ORM: Nice to have ● Upsert – More efficient than alt.: query+insert+update ● PostgreSQL support ● Sqlite support – Very handy for light-weight tests ● DDL/Migration management – Another tool can be used for this ● JSON support
  • 9. 9 Rust ORMs: Popular (>1k*) ● Diesel - 18 years of effort – 8 years old ● Sea-ORM – 9 years of effort – 2 years old ● Rbatis – 7 years of effort – 3 years old Rust database framework ● sqlx - 2 years of effort – 10 years old
  • 10. 10 Rust ORMs: Obscure ● Ormx – 1 year of effort – 2.5 years old ● Rustorm – 2 years of effort – 5 years old - abandoned ● toql - 5 years of effort – 3 years old ● Summer-mybatis – 4 years of effort – 1 year old ● butane - 3 years of effort – 3.5 years old ● sprattus – 1 years of effort – 2 years old ● Yukino-dev - 2 years of effort – 2 years old ● Ormlite – 1 year of effort – 1 year old ● Tql - 2 years of effort - 7 years old
  • 11. 11 Rust ORM: diesel use diesel::prelude::*; #[derive(Queryable)] pub struct Post { pub id: i32, pub title: String, pub body: String, pub published: bool, } Add derives … looks simple
  • 12. 12 Rust ORM: diesel diesel::table! { posts (id) { id -> Int4, title -> Varchar, body -> Text, published -> Bool, } } Except diesel needs a “schema.rs” that defines the database fields for one database Maybe can be generated by diesel API, and injected using progenitor’s “post” hook.
  • 13. 13 Rust ORM: Sea-ORM #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] #[serde(skip_deserializing)] pub id: i32, pub title: String, #[sea_orm(column_type = "Text")] pub text: String, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {} impl ActiveModelBehavior for ActiveModel {} Every model must be called Model
  • 14. 14 Rust ORM: butane #[model] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize, ToSchema)] pub struct Blog { #[serde(default)] pub posts: Many<Post>, #[pk] pub blog_id: uuid::Uuid, #[serde(default, skip_serializing_if = "Option::is_none")] pub slug: Option<String>, } Requires primary keys on each model And “Vec” need to be “butane::Many”