An async & dynamic ORM for Rust that help you build web services in Rust with the familiarity of dynamic languages.
Questions tagged [sea-orm]
27 questions
4
votes
1 answer
SeaORM: The connection string 'sqlite://test.db' has no supporting driver
Using sea-orm-cli to generate a database using sea-orm-cli migrate but this gives the error
thread 'main' panicked at 'called Result::unwrap() on an Err
value: Conn("The connection string 'sqlite://test.db' has no
supporting…

Qwertie
- 5,784
- 12
- 45
- 89
3
votes
1 answer
How to create rocket + sea orm correct json response?
I am new in rust and have problems with correct JSON response in the Rocket framework.
I have Entity that was created by sea-ql I just added [serde(crate = "rocket::serde")] and use rocket::serde::{Deserialize, Serialize};
use…

Beliaf
- 577
- 2
- 8
- 25
3
votes
1 answer
Create entity with no relations
Using SeaOrm, I want to create a model that has no relations. Essentially, a DB with one table.
This seems like it should be super easy, but the documentation doesn't cover this and the DeriveEntityModel macro requires all the boilerplate for entity…

Matthew Goulart
- 2,873
- 4
- 28
- 63
2
votes
1 answer
Rust async loop function blocks another futures execution
I have my app consisting of service and http server.
Service has some things going on with OS api, waiting for events, etc. and it has loop for this purposes as well as async db writes. I start this service with async function.
Server(written with…

dalvi
- 27
- 5
2
votes
0 answers
How can I type check uuid and date_time in an entity generated from sqlite by sea-orm-cli?
I'm using the sea-orm library to manage my database. The uuid() and date_time() types are part of the sea-orm migration syntax. When sea-orm generates the entities from the SQLite database, uuid() and date_time() get converted into String.
Should I…
user20317520
2
votes
1 answer
SeaORM column "owner_id" referenced in foreign key constraint does not exist
I have an error with SeaORM, Rust and Postgres, I'm new in the world of the databases so sorry if this is a newbie question. I wanted to refresh the migrations with sea-orm-cli, but i got this error Execution Error: error returned from database:…

FRostri
- 357
- 1
- 5
- 11
2
votes
0 answers
Multiple `find_with_related()` in sea_orm
Let's say I have a parent::Entity with zero or many good_child::Entity, neutral_child::Entity, and evil_child::Entity. (Just an example. The actual child_* tables have nothing in common with one another).
Each child has a field with its parent's id.…

Kijewski
- 25,517
- 12
- 101
- 143
2
votes
1 answer
Struggling to use sea-orm and axum to get the sum of two columns, each with unique filters, in a postgres db
I wrote a beginner program in Rust that actually is working pretty well, with axum for the web-app and sea-orm to manage the connection to the postgres backend. My struggle is putting together a query, or multiple queries, that can get me the sum of…

eseacr17
- 21
- 2
2
votes
1 answer
Port Postgresql to sea-query
I'm trying to port a Postgres query to a sea-queryin Rust. As I'm new to sea-queryI've reached a point where I have no idea how to port the following SQL code:
WITH agg_data AS
(SELECT tableB_fk
, tableB.name
,…

secana
- 671
- 6
- 15
2
votes
1 answer
How to create a table in SeaORM
I'm trying to see how the TableCreateStatement should be called and where in my code it should live. Looking at the documentation no idea really.
I see I can create a table manually with:
let stmt = sea_query::Table::create()
…

Alper
- 3,424
- 4
- 39
- 45
1
vote
0 answers
How to break sea-orm query using multiline statement
I am a beginner here using sea-orm. I am trying to break down query for filtering my data.
params are input from http query parameters. Based on value of params i want to filter data.
let test = ProductEntity::find();
if…

Anish Poudel
- 11
- 1
- 2
1
vote
0 answers
the trait `async_graphql::OutputType` is not implemented for `entity::user::Model`
i'm trying to return user model in my graphql mutation after it, when i'm making ->ResultUser::Model rust giving an error that the trait 'async_graphql::OutputType' is not implemented for 'entity::user::Model',
i was checking few examples (seaorm…

M1nybe
- 37
- 4
1
vote
1 answer
Sea Orm - Actix , vote system
Django user here. I switching to Actix written in rust.
How to add or subtract 1 from existed value in database.
I have function
post.vote = ActiveValue::Set(post.vote.into_wrapped_value() + 1);
and also tried
post.vote =…

DoDr
- 85
- 7
1
vote
0 answers
How to use a custom PostgreSQL type in SeaORM?
I have the following table in postgres
create table retailers(id: integer, name: citext);
citext is just case insensitive text in PostgreSQL.
How do I modify the Entity creation in SeaORM to support that?
When I generate entities in SeaORM in…

Arun Gokule
- 13
- 2
1
vote
1 answer
What type to use for time/date fields using SeaORM?
Coming from Go I was using this native type for the created_at/updated_at fields:
type Spv struct {
createdAt time.Time
balanceUpdatedAt *time.Time
}
Now with Rust I'm using the .timestamp() method in migrations which creates in…

Fred Hors
- 3,258
- 3
- 25
- 71