On Jul 28, 2012, at 8:38 AM, Alon Horev wrote:

> Hi All,
> 
> When using pysqlite I can pass the following uri to sqlite.connect (i'll 
> explain later why): file:db.sqlite?mode=ro&vfs=unix-none
> 
> I translated it into: sqlite:///db.sqlite?mode=ro&vfs=unix-none in order to 
> pass it to create_engine only to find out that sqlalchemy extracts the 
> parameters to keyword arguments to the connect function. 
> 
> The connect function doesn't handle these arguments. So it seems there are 
> two types of arguments for connect, arguments for the python wrapper 
> (connect's arguments), and arguments to the sqlite library (parameters within 
> the URI).  
> 
> How can I pass those without sqlalchemy extracting them?
> Can I pass a connection initialized myself somehow?

Might be nice if the make_url() function here respected HTML entities on the 
database filename, so in theory one could say: 
"sqlite:///db.sqlite%3Fmode%3Dro%26vfs%3Dunix-none"

However make_url() is not really ready for that, and it's pretty hard to read 
anyway, so just make a URL() object directly:

from sqlalchemy.engine import url, create_engine

e = create_engine(url.URL("sqlite", database="db.sqlite?mode=ro&vfs=unix-none"))


http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html?highlight=url#sqlalchemy.engine.url.URL


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to