Can sqlite read gzipped databases?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Smith

    #1

    Can sqlite read gzipped databases?

    Hi,

    I'd like to read a series of sqlite database files that have already been
    gzipped and was wondering if this can be done on the fly. In other words, can
    I avoid explicitly unzipping the file into another file, but instead get an
    SQL connection to the zip file either directly (can't see an option to do
    this) or to an object in memory resulting from unzipping, eg. (hypothetically );

    import gzip
    from sqlite3 import dbapi2 as sqlite

    data = gzip.GzipFile(' Mydbase.db.gz', 'r')
    d = data.read()
    cnx = sqlite.connect( d) # or .connect(data)
    cur = cnx.cursor()
    .....etc

    The above of course doesn't work, but just to give you the idea.

    Thanks,
    Paul


  • John Nagle

    #2
    Re: Can sqlite read gzipped databases?

    Gzipped files aren't a good random access medium. It's
    unlikely that anyone will implement this.

    John Nagle

    Paul Smith wrote:
    Hi,
    >
    I'd like to read a series of sqlite database files that have already been
    gzipped and was wondering if this can be done on the fly. In other words, can
    I avoid explicitly unzipping the file into another file, but instead get an
    SQL connection to the zip file either directly (can't see an option to do
    this) or to an object in memory resulting from unzipping, eg. (hypothetically );
    >
    import gzip
    from sqlite3 import dbapi2 as sqlite
    >
    data = gzip.GzipFile(' Mydbase.db.gz', 'r')
    d = data.read()
    cnx = sqlite.connect( d) # or .connect(data)
    cur = cnx.cursor()
    ....etc
    >
    The above of course doesn't work, but just to give you the idea.
    >
    Thanks,
    Paul
    >
    >

    Comment

    Working...