Questions tagged [rust-sqlx]

The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL. Don't confuse with the sqlx tag, which is a GO library.

145 questions
0
votes
1 answer

Understanding the where clause in sqlx FromRow Macro Expansion

I don't understand line 3 in the code below. It is a macro expansion of the FromRow trait in sqlx. I through that 'a denoted a lifetime? It seems in this expansion it is being treated as a type and constrained? What does this line mean? …
tjb
  • 11,480
  • 9
  • 70
  • 91
0
votes
0 answers

Propagate different errors when the function output is fixed by a macro

I'm new to rust, and facing an error when propagating different error types (from actix and sqlx in this case). I saw that similar problems are addressed by changing the return of the function to the appropriate type, or to an enum of the different…
Marc Garcia
  • 3,287
  • 2
  • 28
  • 37
0
votes
2 answers

Rust: Read dataframe in polars from mysql

Problem How to read a dataframe in polars from mysql. Docs are silent on the issue. Currently probably there is only support for parquet, json, ipc, etc, and no direct support for sql as mentioned here. Regardless what would be an appropriate method…
Hamza Zubair
  • 1,232
  • 13
  • 21
0
votes
0 answers

rust-sqlx: Lazy instance has previously been poisoned

I'm trying to run cargo fix on a project that uses slqx and am getting the following error: error: proc macro panicked --> src/twitter/domain/user.rs:54:5 | 54 | / sqlx::query!( 55 | | r#" 56 | | INSERT INTO users 57 | | …
ilmoi
  • 1,994
  • 2
  • 21
  • 45
0
votes
1 answer

Rust with sqlx::postgres and i64

I'm new to Rust, and trying to implement an API using sqlx and PostgresQL. When reading about PostgresQL, it seems like it doesn't support u64, as MySQL does. So I have changed my code to i64, as documented here. However it seems like some of my…
Mathias
  • 43
  • 1
  • 6
0
votes
1 answer

I can't capture the DB reference

I'm trying to create an API using Actix-web, async-grahpql and sqlx with postgresql In the QueryRoot of the async-graphql I am trying to capture the reference of the DB and make the query the database with sqlx, but it gives me an error let items =…
BeGo
  • 155
  • 8
-1
votes
1 answer

What data type to use in Rust to match Decimal in MySQL

In MySQL, I have a table My_Table with a column price decimal(20,10) Using sqlx, I want to query and extract the value from MySQL into my function. Below are the relevant code let query = format!("select price from My_Table"); let…
Carlos
  • 19
  • 4
-1
votes
0 answers

Access Heroku DATABASE_URL in GitHub Actions

I'm hosting my application on Heroku with a Postgres DB addon. Reading the doc the credentials are rotated frequently so you need to access the DATABASE_URL env variable to connect to it, but Heroku exposes it only at runtime. My problem is that I…
Bamontan
  • 360
  • 1
  • 11
-1
votes
1 answer

Why this ORDER BY with push_bind doesn't work?

I'm using the below code but the ORDER BY is not respected, I would like to understand why: let mut query = QueryBuilder::new("SELECT * FROM player WHERE tenant_id = "); query.push_bind(tenant_id); if let Some(order_by) = &input.order_by { for…
Fred Hors
  • 3,258
  • 3
  • 25
  • 71
-1
votes
1 answer

How to resolve "dropped here while still borrowed" when creating a borrowing object in async context?

I try to create a transaction object from a parent connection being in async context. Here is a distilled situation: use std::fmt::Debug; use std::future::Future as StdFuture; use std::pin::Pin; use std::result::Result as…
ababo
  • 1,490
  • 1
  • 10
  • 24
1 2 3
9
10