Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3.OperationalError: table associations already exists #1079

Open
MRIDude opened this issue Aug 11, 2024 · 4 comments
Open

sqlite3.OperationalError: table associations already exists #1079

MRIDude opened this issue Aug 11, 2024 · 4 comments

Comments

@MRIDude
Copy link

MRIDude commented Aug 11, 2024

I am currently running the newest version of pybids. On ubuntu 20.04 and 22.04. I am running three lines of code:

`import bids as BIDS

layout=BIDS.BIDSLayout('/data/jsp/human2/BidsDataset/PIB')

layout.save('/data/jsp/human2/BidsDataset/Scripts/PIBproject') `

I get the following error

Traceback (most recent call last):
File "", line 1, in
File "/data/jsp/human2/fcMRI/Aaron/locals/Ubuntu20.04/local/pkg/anaconda/envs/bids/lib/python3.12/site-packages/bids/layout/layout.py", line 365, in save
self.connection_manager = self.connection_manager.save_database(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/jsp/human2/fcMRI/Aaron/locals/Ubuntu20.04/local/pkg/anaconda/envs/bids/lib/python3.12/site-packages/bids/layout/db.py", line 139, in save_database
new_db.execute(line)
sqlite3.OperationalError: table associations already exists

I have run these three lines before with out an issue. Have I done some thing wrong.

@MRIDude
Copy link
Author

MRIDude commented Aug 12, 2024

This morning I looked into this an little further. It is occurring because the sqlite file already exist. This has never happened to me before. However I have not run this script since before pybids 0.17.0 came out.

@effigies
Copy link
Collaborator

effigies commented Dec 4, 2024

Does this occur when using the same version of pybids in each database, or could this be a problem of version mismatch?

@MRIDude
Copy link
Author

MRIDude commented Dec 4, 2024

It has been some time since I posted this. I concluded that it was the upgrade to pypids 0.17.0. I remember it not being a version mismatch. I would have tested for that.

@effigies
Copy link
Collaborator

effigies commented Dec 4, 2024

Ah, here's a reproduction:

import bids

layout = bids.BIDSLayout('/data/openneuro/ds000001')
layout.save('/tmp/ds000001.db')
layout.save('/tmp/ds000001.db')

I can't make it not fail in this way, going back to 0.14.0. So I'm not sure why it was ever not failing for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants