Re: [sqlite] Is there a way to yield an error when opening a nonexistent dbfile?

2020-01-31 Thread Keith Medcalf
, 2020 17:49 >To: SQLite mailing list >Subject: Re: [sqlite] Is there a way to yield an error when opening a >nonexistent dbfile? > >What is the recommended way to do so in python? > >I see the following two ways. > >``` >db = sqlite3.connect('file:/path/to/database

Re: [sqlite] Is there a way to yield an error when opening a nonexistent dbfile?

2020-01-31 Thread Peng Yu
What is the recommended way to do so in python? I see the following two ways. ``` db = sqlite3.connect('file:/path/to/database?mode=ro', uri=True) fd = os.open(filename, os.O_RDONLY) c = sqlite3.connect('/dev/fd/%d' % fd) os.close(fd) ``` https://stackoverflow.com/questions/10205744/opening-sql

Re: [sqlite] Is there a way to yield an error when opening a nonexistent dbfile?

2020-01-31 Thread Kees Nuyt
On Fri, 31 Jan 2020 09:02:10 -0600, Peng wrote: > Hi, > > By default the command sqlite3 will just open a dbfile if it does not exist. > > Suppose that I just want to perform read-only operations in a sqlite3 > session, I will not need to create a non-exsitent file. Rather, I want > the sqlite3 to

[sqlite] Is there a way to yield an error when opening a nonexistent dbfile?

2020-01-31 Thread Peng Yu
Hi, By default the command sqlite3 will just open a dbfile if it does not exist. Suppose that I just want to perform read-only operations in a sqlite3 session, I will not need to create a non-exsitent file. Rather, I want the sqlite3 to fail when the dbfile does not exist. Is there a way to achie