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

sqlite dburi is not an uri #202

Open
tiran opened this issue Jun 1, 2017 · 0 comments
Open

sqlite dburi is not an uri #202

tiran opened this issue Jun 1, 2017 · 0 comments

Comments

@tiran
Copy link
Member

tiran commented Jun 1, 2017

The sqlite storage plugin takes a dburi parameter. However the parameter does not take URIs as defined in https://www.sqlite.org/c3ref/open.html. The code assumes that the dburi parameter is a path to a file. Neither :memory: nor file: URIs are supported.

Custodia should also use PRAGRMA to get the actual path of the sqlite file for chmod().

>>> c = sqlite3.connect(':memory:')
>>> c.execute('PRAGMA database_list;').fetchall()
[(0, 'main', '')]
>>> c = sqlite3.connect('/tmp/test.db')
>>> c.execute('PRAGMA database_list;').fetchall()
[(0, 'main', '/tmp/test.db')]
# Python 3 only
>>> c = sqlite3.connect('file:/tmp/test.db', uri=True)
>>> c.execute('PRAGMA database_list;').fetchall()
[(0, 'main', '/tmp/test.db')]
>>> c = sqlite3.connect('test.db', uri=True)
>>> c.execute('PRAGMA database_list;').fetchall()
[(0, 'main', '/home/heimes/redhat/pki/test.db')]
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

1 participant