Giter Site home page Giter Site logo

qvdfile's Introduction

qvdfile

QVD File reader and writer (exploratory version)

This is python3 object created to explore QVD file, it can be used

  • to read QVD file Metadata
  • to read column values from QVD file
  • to read rows from QVD file

Sample usage:

import qvdfile 

qvd = qvdfile.QvdFile ("test.qvd")

print("File has {} records".format(qvd.attribs["NoOfRecords"]))

print("File has column '{}' with first value of '{}'".format(
  qvd.fields[0]["FieldName"],qvd.getFieldVal(qvd.fields[0]["FieldName"],0)))
  
print("First row of the file is {}".format(qvd.getRow(0)))

The structure of QVD file is described in Wiki.

Performance

This is explarotary version and it is not suited for production usage. Code simplicity is the first priority. If you need better performance please contact the author: QVD files can be read much much faster by other version of software.

Reading fields

QVD file does not allow indexing - it is impossible to read field #N without reading (N-1) previous fields. This version contains no caching - if you read field #4 and then read field #5 you will read 4 fields first and then read 4 same fields again... This is done specificly for simplicity.

It is faster to read first fields then the last fields. It is nearly impossible to read field #10 000 000 (while it is OK to read field #1000).

Reading rows

The same is true for rows: the smaller the index the faster it is read. The reason is simple - QVD files usually contain first symbols in the first rows. I would not try to read row #100 000 (and will not try #1000 as well).

For performance contact the author.

Dependencies

Code is simple and depends only on bitstring module:

pip install bitstring

Unit tests

Unit tests are provided as a sort of documentation - they describe what to expect from the code (or how it was supposed to be used by the author).

qvdfile's People

Contributors

korolmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

qvdfile's Issues

Fails on filenames including more than one '.'

When attempting to handle filenames/filepaths that include more than one '.' character, the library infers the wrong file type since it arbitrarily looks for the "qvd"/"xml" extension after the first period. Better to use a regular expression to make this determination. I fixed a fork of this by revising qvdfile.py by adding:

import re

And changing line 25 to:

self.mode = os.O_RDONLY if re.match('^.*qvd$', name, re.IGNORECASE) else os.O_WRONLY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.