473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Py+SQLite or other (big output) ?

Hi !

I want to process many data with python, and want to store in database.
In the prior version of my code I create a simple thing that delete the
old results, recreate the database and fill up it.

But that is not too flexible, because when an power supply or hardware
problem occured, all of the processed items are lost.

Then I thinking about a solution that can continue the work. This is
like an diff or sync. directories problem.
Everytime I need to compare existing datas with inputs, and get result
about this database: is finished, or I need to drop/add some elements.

That is not to hard to code, but I see that the very large files are
very vulnerable.
Example: the older version of my code is use zip to export files... When
I processed many files, I access the physical limit of the zip (4 GB),
and every results destroyed in the crash...
Or when the database file is getting inconsistent state, I only way to
make result is to drop db, and recreate it.

So I thinking about that I split the datas into smaller sections, and
use them. If any of them destroyed or injured, I need to recreate only that.
But this solution have a problems too.
1.) I need a header file to "join" them logically. When this file
injured, every data must drop.
2.) The sync. operation is harder, because some files are not needed
(when input data amount less than before), or some records are not
needed; or I need to add some records to some of the files.
3.) I need to use global db to store global values.

If I use this concept, I pay with hardest coding, and many-many bug chance.

So I want to use one database file - but I want to protect it.
How to do it with SQLite ?
I see that solutions:
- 1. I use transactions.
- 2. I create full copy of database after every bigger transation.
- 3. Shadow file ???
- 4. Mirror database (this is problematic to synch.).

The transactions are very good things, but does not protect the database
from injuring.
The copy operation is better, but very decrease the processing speed,
because the result db grow fast, and copy of 1/2,2/3 GBs is slow, and
not too good.

Have SQLite any solution to this problem ?

Or have you any solution to this problem ? Hash-DB ? Pickled elements ?

Thanx for the help:
dd

Apr 3 '06 #1
1 1180
DurumDara wrote:
I want to process many data with python, and want to store in database. .... So I want to use one database file - but I want to protect it.
How to do it with SQLite ?
I see that solutions:
- 1. I use transactions.
- 2. I create full copy of database after every bigger transation.
- 3. Shadow file ???
- 4. Mirror database (this is problematic to synch.).

The transactions are very good things, but does not protect the database
from injuring.
The copy operation is better, but very decrease the processing speed,
because the result db grow fast, and copy of 1/2,2/3 GBs is slow, and
not too good.


With these requirements (data recovery, sizes of several gigabytes,
transaction safety etc) you might consider something "heavier" than
SQLite.

Of course, there is more work to administer something like DB2, Oracle
or PostgreSQL than SQLite, but at least the code is as easy as for
SQLite, and they are built to provide very robust storage of large
amounts of data in a transaction safe way, with ample possibilities
to spread out data across disks etc.

Also, with e.g. Oracle, you can define the max sizes of the database
files so that disks never get full. If the allotted files are all
full, there won't be any crash. You will just get a error from the
last INSERT, and stay in your transaction. If you catch this error
and alert the user, more disk space could be made available for the
database, the erring INSERT repeated and then you just go on with the
rest. I think you could do the same in recent PostgreSQL versions
by using savepoints. (PostrgeSQL requires a rollback after an SQL
error--savepoints enables you to rollback less than a full
transacion.)
Apr 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: zelzel.zsu | last post by:
I am a new learner of Python Programming Language. Now. I am reading a book. In the section relating to module, I see an example. the directory tree looks like below: root\ system1\...
9
by: svenn.are | last post by:
Hi, has anybody thought of / already used graphviz to convert the output of trace.py into a graph? I looked at PyUMLGraph, but 1. PyUMLGraph does not successfully create a dot file, and 2. I...
2
by: Christian Stooker | last post by:
Part one: ====== Hi ! I want to use SQLite database like the FireBird database: with big isolation level. What's that meaning ? I have an application that periodically check some input...
0
by: . | last post by:
http://daviderognoni.blogspot.com?locawapp - MAIN NEWS =========== * add thread * add "Request" object * new "locawapp_main" function * fixed files.py
12
by: John Salerno | last post by:
I've been looking around and reading, and I have a few more questions about SQLite in particular, as it relates to Python. 1. What is the current module to use for sqlite? sqlite3? or is that not...
1
by: rdrink | last post by:
I will try to keep this as suscinct as possible as it might be an obvious Q..... I am just getting into Py/sqlite (with a fair amount of PHP/MySQL background), and am posting this as much for the...
4
by: Barry | last post by:
Hi, guys Basiclly, it is automated testing system. There is a main python script that handles the testing campagin. This main script will call another script that will in turn runs a few...
0
by: smitty1e | last post by:
Disclaimer(s): the author is nobody's pythonista. This could probably be done more elegantly. The driver for the effort is to get PyMacs to work with new-style classes. This rendering stage...
9
by: Ed Leafe | last post by:
On Apr 21, 2008, at 1:05 PM, Daniel Fetchinson wrote: Don't most binary distributions include SQLite itself? I installed 2.5.2 on a new WinXP VM, and SQLite is working fine. -- Ed Leafe
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.