question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sqlite3.OperationalError: too many SQL variables

See original GitHub issue

I am using ivadomed (git-master-97b5772374660b12895f7a458941f468090e8bf8*)

I run into the above error when trying to train on the spine generic dataset. Don’t really know what’s causing that.

Traceback (most recent call last):
  File "/home/etetteh/venv_ivadomed/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/home/etetteh/venv_ivadomed/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: too many SQL variables

Screen Shot 2022-01-31 at 22 53 33

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mariehbourgetcommented, Feb 1, 2022

There would be one thing to fix in the config file in contrast_params. The contrasts in BIDS is always the last part of the filename after the last underscore, so “T1w_MTS” and “MTon_MTS” should be replaced by “MTS” only in:

        "contrast_params": {
            "training_validation": ["T1w", "T1w_MTS", "T2w", "T2star", "MTon_MTS"],
            "testing": ["T1w", "T1w_MTS", "T2w", "T2star", "MTon_MTS"],
            "balance": {}
        },

Other than that, everything looks fine.

I would suggest to fix the contrast_params and try the training again. However, I doubt that this is what is causing the issue with the pybids indexing here.

If the training fails again, I would recommend trying locally on your computer just to see if you get the same error as in compute canada.

0reactions
dyt811commented, Feb 2, 2022

Okay, current theory on this is likely related to the SQLite database being built under BIDSLayout (a package we use) having a hard limit on SQLITE_MAX_COLUMN, as elaborated a bit here: https://stackoverflow.com/a/67673249. We will likely needs to check SQLite version and its limit and see if there is a way to recompile SQLite with higher limit to see if it gets around this issue. I just requested Compute Canada credential and will try to replicate the problems.

AFAIK, this is a lower library issue meaning we won’t be able to address it just by making code change on our side. More investigation will be required once I get my CC access.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Too many SQL variables" error in django with sqlite3
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 >
"too many SQL variables" Error with pandas 0.23 ... - GitHub
Now I receive this error "OperationalError: (sqlite3.OperationalError) too many SQL variables". I am converting a dataframe with ~20k+ rows ...
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 >
SQlite3: too many SQL variables, Foreign Keys & Delete
%s, %s.... And so on (1180 total in my case) }}} Errors: {{{ django.db.utils.OperationalError: too ...
Read more >
Too many SQL variables" error in django with sqlite3-django
There is no way to bypass this, it's an SQLITE limitation. Your query will run fine on MySQL however. But if you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found