473,385 Members | 1,973 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,385 software developers and data experts.

File DB instead of real database?

Hello all

I donot want to use a real DB like MySQL ... But I need something to
save about more than 1000 articles.
Is there any good ways?

Thanx

Jia Lu

Apr 14 '07 #1
6 1306
Jia Lu wrote:
I donot want to use a real DB like MySQL ... But I need something to
save about more than 1000 articles.
Is there any good ways?
(in Python 2.5):

#-- begin
import sqlite3.dbapi2 as sqlite

con = sqlite.connect("path/to/new/filename.db")
cur = con.cursor()
cur.executescript("""
create table articles (id integer primary key autoincrement,
name text,
content clob);
create index articles_name on articles (name);

insert into articles (name, clob)
values ("My new article", "Article text. blah blah");

""")

con.commit()

#-- end

--
pkm ~ http://paulmcnett.com

Apr 14 '07 #2
Jia Lu wrote:
I donot want to use a real DB like MySQL ... But I need something to
save about more than 1000 articles.
Is there any good ways?
import anydbm
Richard

Apr 14 '07 #3
On Apr 13, 9:14 pm, "Jia Lu" <Roka...@gmail.comwrote:
I do not want to use a real DB like MySQL ...
But I need something to save about more than
1000 articles. Is there any good ways?
The latest version of Dejavu includes a filesystem backend. See
"Folders" at http://projects.amor.org/docs/dejavu...age.html#other
Robert Brewer
System Architect
Amor Ministries
fu******@amor.org

Apr 14 '07 #4
On 14 avr, 06:14, "Jia Lu" <Roka...@gmail.comwrote:
Hello all

I donot want to use a real DB like MySQL ... But I need something to
save about more than 1000 articles.
Is there any good ways?
Hi,

For small sets of data PyDbLite is a good alternative to full-blown db
engines
>>import PyDbLite
db = PyDbLite.Base("records").create('title','artist')
db.insert('Ok Computer','Radiohead')
0
>>db.insert('Night On Earth','Rialto')
1
>>db.insert('Employment','Kaiser Chiefs')
2
>>print [ r['title'] for r in db ]
['Ok Computer', 'Night On Earth', 'Employment']
>>print [ r['artist'] for r in db if r['artist'].startswith('R') ]
['Radiohead', 'Rialto']
>>>
The syntax is intuitive for Python programmers (list comprehensions) ;
it's a single, small Python module downloable at
http://quentel.pierre.free.fr/PyDbLite/index.html

Regards,
Pierre

Apr 14 '07 #5
Jia Lu a e'crit :
Hello all

I donot want to use a real DB like MySQL ...
Whether MySQL is qualifies as a "real DB" is still an open question. But
you can use SQLite, which is an embedded SQL database.
Apr 16 '07 #6
On 13 Apr 2007 21:14:36 -0700, Jia Lu <Ro*****@gmail.comwrote:
I donot want to use a real DB like MySQL ... But I need something to
save about more than 1000 articles.
Is there any good ways?
SQLite is a good option, as you were told. But what about put them in
a dictionary and then cPickle it to disk? (using 2 as optimization
setting in cPickle command).
Apr 16 '07 #7

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

Similar topics

13
by: darkhorse | last post by:
Hi all, While doing a quite big "set of programs" for a university subject I've found myself in the middle of a problem someone surely has had before, so I'm looking for some help. At one...
4
by: HEATHER CARTER-YOUNG | last post by:
Please help. I have two databases - one I'm designing that will be our in-house data mgmt system (db1) and another that is a federally-mandated system (db2). We must submit data from db2 but don't...
3
by: herman404 | last post by:
Hi everyone, I have data coming to me in the form of Word and Excel files, and I need to place this data into a SQL Server database. The Word file will be coming in text which is similiar to an...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
MMcCarthy
by: MMcCarthy | last post by:
This is a module that imports information to a Query or a Table from comma separated values file in a text format! It is very helpful for getting information from other applications and from files! ...
20
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, If in an ASP program, I need to display a pdf file link for users to print and read. Is there any security issue? We are thinking about doing this is many mail servers block emails with...
3
by: Sean C. | last post by:
Hey All, I'm having a little problem here. I have a project that I'm working on that involves a MySQL server database backend. I'm having no problem creating the database on the fly if it...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.