Questions tagged [sea-query]

Use for questions about dynamic SQL query builder for MySQL, Postgres and SQLite using Rust

6 questions
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
1
vote
1 answer

sea-query - trait `&TableDef: Iden` is not statisfied

I'm new to sea-query and sea-schema. I've extracted the schema from an sqlite database like this: let url = "sqlite://test.db"; let connection = SqlitePool::connect(&url).await.unwrap(); let schema_discovery = SchemaDiscovery::new(connection); let…
Drago96
  • 1,265
  • 10
  • 19
0
votes
0 answers

How to construct a complex LEFT JOIN with aliasing using sea-query in Rust?

I'm working on a Rust project where I use sea-query to build SQL queries. I have the following SQL query: SELECT * FROM tblcomponent AS com1 LEFT JOIN tblcomponent AS com2 ON com1.intParentComponentId_fk=com2.intId_pk LEFT JOIN tblcomponent AS…
Rainb
  • 1,965
  • 11
  • 32
0
votes
1 answer

Bulk insert using sea-query?

How to construct a query with a bulk insert? let (query, values) = Query::insert() .into_table(DbAppointmentService::Table) .columns([ DbAppointmentService::Id, DbAppointmentService::AppointmentId, …
Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68
0
votes
1 answer

How to add an alias to the selected field?

I want to join two tables with the id fields. Later, I want to access those fields using row.get("field_name") method from sqlx. As far as two fields have the same name I want to add an alias to prevent the naming collision. Here is my code…
Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68
0
votes
1 answer

Wrong type when mapping result rows using sea-query builder + sqlx

I want to query a user from my users table of Postgres database. ... // Build Query let (sql, values) = Query::select() .columns([DbUser::Id, DbUser::Name, DbUser::Email]) .from(DbUser::Table) …
Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68