SQLite: Queries in large tables result in error: "too many SQL variables"
See original GitHub issuePhoton query:
const result = await photon.users.findMany({
include: { listings: true },
first: 1000,
})
Error:
Error: Error in Photon:
ConnectorError(QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("too many SQL variables"))
stack backtrace:
0: backtrace::backtrace::trace::h1a2de69e72ae183d (0x10844858e)
1: backtrace::capture::Backtrace::new_unresolved::h930294fe2b60b491 (0x1084467b8)
2: failure::backtrace::internal::InternalBacktrace::new::hb4d9ca333d8b97ee (0x108446149)
3: <failure::backtrace::Backtrace as core::default::Default>::default::h84240357500db3cb (0x108446345)
4: prisma_query::connector::sqlite::error::<impl core::convert::From<rusqlite::error::Error> for prisma_query::error::Error>::from::hf298c162f582cb13 (0x107f8e43c)
5: <prisma_query::connector::sqlite::Sqlite as prisma_query::connector::queryable::Queryable>::query_raw::h51d6e25decaab2c7 (0x107f389e2)
6: <prisma_query::connector::sqlite::Sqlite as prisma_query::connector::queryable::Queryable>::query::h32f5303eeeca0cf2 (0x107f388a3)
7: <prisma_query::connector::transaction::Transaction as prisma_query::connector::queryable::Queryable>::query::h192e8db415df29e1 (0x107f37b04)
8: sql_connector::transactional::Transaction::filter::hfdab086602d8948b (0x107ae551f)
9: <sql_connector::database::sqlite::Sqlite as sql_connector::transactional::Transactional>::with_transaction::h702b1d7b1af5a421 (0x107adc9ff)
10: sql_connector::transactional::database_reader::<impl connector::database_reader::DatabaseReader for sql_connector::database::SqlDatabase<T>>::get_related_records::h4aede35a0c6e877e (0x1079ba4bc)
11: core::executor::read::ReadQueryExecutor::execute_internal::haecb451438660609 (0x107e023c2)
12: core::executor::read::ReadQueryExecutor::execute_internal::haecb451438660609 (0x107e01f8c)
13: core::executor::Executor::exec_all::hb54bd9867739d740 (0x107e17f05)
14: <prisma::req_handlers::graphql::GraphQlRequestHandler as prisma::req_handlers::RequestHandler>::handle::h41e568e17d805b7f (0x107afeb16)
15: prisma::http_handler::h187ccae613b092a6 (0x107ad6a2f)
16: <F as actix_web::with::FnWith<T,R>>::call_with::hf203f46a5c135e6a (0x107aa2d93)
17: <actix_web::with::WithHandlerFut<T,S,R> as futures::future::Future>::poll::h11fd0baab6b65238 (0x107aa8e81)
18: actix_web::pipeline::PipelineState<S,H>::poll::h77c547f95d492bad (0x107af41c4)
19: <actix_web::pipeline::Pipeline<S,H> as actix_web::server::handler::HttpHandlerTask>::poll_io::h4b4a4021dcf2d06d (0x107ae09c0)
20: actix_web::server::h1::Http1Dispatcher<T,H>::poll_handler::hfe0a22ea3f30a162 (0x107a2025a)
21: actix_web::server::h1::Http1Dispatcher<T,H>::poll::h6fc5c18508d493ed (0x107a44dfb)
22: <actix_web::server::channel::HttpChannel<T,H> as futures::future::Future>::poll::hb8847c07edbe81f1 (0x107a43cb6)
23: <actix_web::server::channel::HttpChannel<T,H> as futures::future::Future>::poll::hb8847c07edbe81f1 (0x107a44b38)
24: <actix_net::service::and_then::AndThenFuture<A,B> as futures::future::Future>::poll::h190bff2ee3d92d35 (0x107ad7596)
25: futures::future::chain::Chain<A,B,C>::poll::h2490b49ecdbb3436 (0x1079f3f74)
26: futures::task_impl::std::set::h34c3cefc72e9d909 (0x107bbda6d)
27: futures::task_impl::Spawn<T>::poll_future_notify::h98e458ebb3f89aba (0x107bd6cdf)
28: tokio_current_thread::CurrentRunner::set_spawn::h4ac0f157606d6fba (0x107bb7c44)
29: tokio_current_thread::scheduler::Scheduler<U>::tick::h177d32891b38fe09 (0x107bc3fd5)
30: tokio_current_thread::Entered<P>::block_on::hd37e9b7670d91ea3 (0x107bb85aa)
31: std::thread::local::LocalKey<T>::with::hc75773ff23913458 (0x107bcf6d4)
32: std::thread::local::LocalKey<T>::with::hf544a5364bf9c7c3 (0x107bd0b87)
33: std::thread::local::LocalKey<T>::with::hcc019581b7396208 (0x107bcf8dc)
34: std::thread::local::LocalKey<T>::with::h126c4f06e863c307 (0x107bcd128)
35: tokio::runtime::current_thread::runtime::Runtime::block_on::hf81730b6f79d993c (0x107bbc282)
36: std::sys_common::backtrace::__rust_begin_short_backtrace::h753ec407d4740e7a (0x107bd4878)
37: std::panicking::try::do_call::h9393930e85833ba4 (0x107bba3cb)
38: __rust_maybe_catch_panic (0x108479def)
39: core::ops::function::FnOnce::call_once{{vtable.shim}}::ha9433e4bb47d481d (0x107bd5106)
40: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hf8766009c029bc09 (0x108460a8e)
41: std::sys::unix::thread::Thread::new::thread_start::hfdef4649a42cf26c (0x10847935e)
42: _pthread_body (0x7fff79d5b2eb)
43: _pthread_start (0x7fff79d5e249)))
at PhotonFetcher.<anonymous> (/Users/schickling/Desktop/cwd/new-server/node_modules/@generated/photon/index.js:35:23)
at Generator.throw (<anonymous>)
at rejected (/Users/schickling/Desktop/cwd/new-server/node_modules/@generated/photon/index.js:5:65)
at processTicksAndRejections (internal/process/task_queues.js:89:5)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
sqlite3.OperationalError "too many SQL variables" when ...
The backend is done in Flask, and the database I am using is SQLite3 (with Flask-SQLAlchemy). The problem is that I needed to...
Read more >'too many SQL variables' error with ModelMultipleChoiceField
Hello, I have a form with ModelMultipleChoiceField on it, and I am getting 'DatabaseError: too many SQL variables' (using SQLite) when the user...
Read more >Too many SQL variables" error in django with sqlite3-django
I'm getting this error using sqlite3 in django: Exception Value: too many SQL variables. And I think the answer to it is this,...
Read more >error too many sql variables - CSPro Users Forum
Re: error too many sql variables That error is probably coming from SQLite which has a limit of 999 variables in a single...
Read more >Pragma statements supported by SQLite
The application_id PRAGMA is used to query or set the 32-bit signed big-endian "Application ID" integer located at offset 68 into the database...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Setting to Arch Linux default 250000.
Fixed in alpha.