well, the url is broken out like this:

dbtype://  /  <database>

so when you put four slashes, your database is  "/tmp/foo.db".  three  
slashes, your database is "tmp/foo.db".  that gets sent to the sqlite  
engine as the file to use.

we can just say, sqlite databases get a slash prepended, unless it  
starts with a period.  for backwards compatibility, extra slashes at  
the front get munged down to one.

so absolute:

        dbtype:///tmp/foo.db

relative:

        dbtype:///./tmp/foo.db

old absolute way still works:

        dbtype:////tmp/foo.db

old relative way breaks:

        dbtype:///tmp/foo.db -> no longer relative.

can sqlite users handle that relatively small level of pain for  
release 0.2.5 ?

On Jun 29, 2006, at 3:52 PM, Kevin Dangoor wrote:

> OK. I found the problem, but it's not exactly what I'd expect.
>
> Apparently, to take a path from the root for an sqlite file you need
> *four* slashes.
>
> sqlite:////tmp/foo.db
>
> It's nice being able to do relative paths (something that SQLObject's
> URIs don't let you do), but 4 slashes just seems excessive :)
>
> On 6/29/06, Kevin Dangoor <[EMAIL PROTECTED]> wrote:
>> I'm having some trouble making a new sqlite database. I can create
>> in-memory databases just fine, but I can't seem to create one on  
>> disk.
>> I am certain that I have permissions to the file i'm trying to  
>> create.
>>
>> Unfortunately, the error and the code don't give me anything to work
>> with for troubleshooting. The failure occurs in a lambda, and I have
>> no way of knowing what the options were (short of modifying  
>> sqlalchemy
>> itself).
>>
>> I just installed the latest versions of pysqlite (2.3.1) and  
>> sqlite (3.3.6)
>>
>>>>> from sqlalchemy import *
>>>>> e = create_engine("sqlite:///tmp/hithere.db")
>>>>> e.connect()
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> engine/base.py",
>> line 470, in connect
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> engine/base.py",
>> line 177, in __init__
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> engine/base.py",
>> line 493, in raw_connection
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> engine/default.py",
>> line 34, in get_connection
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> pool.py",
>> line 85, in connect
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> pool.py",
>> line 135, in __init__
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> pool.py",
>> line 110, in get
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> pool.py",
>> line 204, in do_get
>>   File "build/bdist.darwin-8.6.0-Power_Macintosh/egg/sqlalchemy/ 
>> engine/default.py",
>> line 27, in <lambda>
>> pysqlite2.dbapi2.OperationalError: unable to open database file
>>>>> e = create_engine("sqlite:///:memory:")
>>>>> e.connect()
>> <sqlalchemy.engine.base.Connection object at 0x555450>
>>
>
>
> -- 
> Kevin Dangoor
> TurboGears / Zesty News
>
> email: [EMAIL PROTECTED]
> company: http://www.BlazingThings.com
> blog: http://www.BlueSkyOnMars.com
>
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to