Skip to content

Sqlite query_as! cannot find types #337

@D1plo1d

Description

@D1plo1d

I am migrating my code base from sqlx postgres to sqlx sqlite. I've ran sqlx migrate run successfully but I am now getting errors for each query_as! macro that every column's type isn't found in the database:

error: database couldn't tell us the type of column #1 ("id"); this can happen for columns that are the result of an expression
  --> src/models/user/mod.rs:64:23
   |
64 |           let db_user = sqlx::query_as!(
   |  _______________________^
65 | |             User,
66 | |             "
67 | |                 SELECT * FROM users
...  |
70 | |             user.user_id.parse::<i32>()?
71 | |         )
   | |_________^
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Is this a known issue? Something I've misconfigured?

Edit: I should add that running PRAGMA table_info(users); from the sqlite3 CLI shows a user table with an id column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions