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

Database connection error: near "(": sytax error #3175

Closed
rebeck opened this issue Dec 27, 2018 · 15 comments
Closed

Database connection error: near "(": sytax error #3175

rebeck opened this issue Dec 27, 2018 · 15 comments

Comments

@rebeck
Copy link

rebeck commented Dec 27, 2018

Starting headphones I get "Can't connect to the database: near "(": syntax error. My music is connected to a Drobo NAS. Any ideas?

@AdeHub
Copy link
Collaborator

AdeHub commented Dec 27, 2018

Post Verbose/Debug logs

@rebeck
Copy link
Author

rebeck commented Dec 27, 2018

27-Dec-2018 08:19:30 - INFO :: MainThread : Checking to see if the database has all tables....
27-Dec-2018 08:19:30 - ERROR :: MainThread : Can't connect to the database: near "(": syntax error
27-Dec-2018 08:19:30 - INFO :: MainThread : Retrieving latest version information from GitHub
27-Dec-2018 08:19:31 - INFO :: MainThread : Headphones is up to date
27-Dec-2018 08:19:31 - INFO :: MainThread : Starting Headphones web server on http://0.0.0.0:8181/
27-Dec-2018 08:19:38 - INFO :: MainThread : Scheduled background task: Search for Wanted
27-Dec-2018 08:19:38 - INFO :: MainThread : Scheduled background task: Download Scan
27-Dec-2018 08:19:38 - INFO :: MainThread : Scheduled background task: Library Scan
27-Dec-2018 08:19:38 - INFO :: MainThread : Scheduled background task: MusicBrainz Update

@AdeHub
Copy link
Collaborator

AdeHub commented Dec 28, 2018

Do you know what version of SQLite you're using?

@rebeck
Copy link
Author

rebeck commented Dec 28, 2018

sqlite3.sqlite_version '3.6.21'

@AdeHub
Copy link
Collaborator

AdeHub commented Dec 28, 2018

Could be these lines

Try replacing with:

    # exists = c.execute('SELECT * FROM pragma_index_info("have_matched_artist_album")').fetchone()
    # if not exists:
    #     c.execute('CREATE INDEX have_matched_artist_album ON have(Matched ASC, ArtistName COLLATE NOCASE ASC, AlbumTitle COLLATE NOCASE ASC)')
    #     c.execute('DROP INDEX IF EXISTS have_matched')

    c.execute('CREATE INDEX IF NOT EXISTS have_matched_artist_album ON have(Matched ASC, ArtistName COLLATE NOCASE ASC, AlbumTitle COLLATE NOCASE ASC)')
    c.execute('DROP INDEX IF EXISTS have_matched')

@rebeck
Copy link
Author

rebeck commented Dec 29, 2018

There was no difference. Database connection error: near "(": sytax error still there

@rebeck
Copy link
Author

rebeck commented Dec 30, 2018

Headphones used to work perfectly in the past. Should I uninstall Headphones and reinstall it?

@rholland-keystone
Copy link

rholland-keystone commented Jan 3, 2019

headphones/init.py starting line 447

It's this block of code here:

exists = c.execute('SELECT * FROM pragma_index_info("have_matched_artist_album")').fetchone()
if not exists:
c.execute('CREATE INDEX have_matched_artist_album ON have(Matched ASC, ArtistName COLLATE NOCASE ASC, AlbumTitle COLLATE NOCASE ASC)')
c.execute('DROP INDEX IF EXISTS have_matched')

My compiler complains the line creating the index is too long, so maybe it's being truncated? Sadly I'm not overly Python-y or SQLite-y, but commenting that section out gets me rolling again,

@AdeHub
Copy link
Collaborator

AdeHub commented Jan 3, 2019

Does it work like this?

        c.execute(
            'CREATE INDEX have_matched_artist_album ON have(Matched ASC, ArtistName COLLATE NOCASE ASC, AlbumTitle COLLATE NOCASE ASC)')

@rholland-keystone
Copy link

@AdeHub that does not prevent the error.

Python 2.7
SQLite 3.6.21

@AdeHub
Copy link
Collaborator

AdeHub commented Jan 4, 2019

Maybe this?

    # exists = c.execute('SELECT * FROM pragma_index_info("have_matched_artist_album")').fetchone()
    # if not exists:
    c.execute(
        'CREATE INDEX IF NOT EXISTS have_matched_artist_album ON have(Matched ASC, ArtistName COLLATE NOCASE ASC, AlbumTitle COLLATE NOCASE ASC)')
    c.execute('DROP INDEX IF EXISTS have_matched')

@rebeck
Copy link
Author

rebeck commented Jan 6, 2019 via email

@AdeHub
Copy link
Collaborator

AdeHub commented Jan 6, 2019

Can you try the develop branch

@rebeck
Copy link
Author

rebeck commented Jan 6, 2019

I am not sure how to do it.

@rholland-keystone
Copy link

@AdeHub the code in develop does allow headphones to start correctly.

@AdeHub AdeHub closed this as completed in dc22bb0 Jan 8, 2019
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

3 participants