|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
New database interface
As part of my project to make a decent framework to develop web sites with that isn't as "heavy" as Zope, I've started work on a module to make handling databases nice and easy.
There are two things that annoy me about databases: 1) When you use a new host and find that you have to change all of your MySQL code to, for example, flat-file database code 2) Having to write the same lines over and over for queries, etc. So this module tries to make the kinds of simple operations I need for web sites nice and easy. I've attached the module so far to this message along with the requisite config.py. But here's an example of its use: Code:
>>> import db
>>> mydb = db.DB('mysql')
>>> mydb.info()
{'tables': ['calendar', 'campaigns', 'pages', 'pressreleases', 'rdb_articles', 'rdb_categories', 'resources'],
'hostname': 'localhost', 'dbname': 'readingc_campaignforum', 'ctime': 'Sat, 22 Nov 2003 12:46:46 +0000'}
>>> mydb.fetchRow('calendar', 'name,eventdate', 'id', '6')
{'name': 'Human Rights in Chechnya', 'eventdate': '2003-03-10'}
Last edited by telex4 : November 22nd, 2003 at 06:59 AM. |
|
#2
|
||||
|
||||
|
You might find the PDO project interesting Telex:
http://sourceforge.net/docman/displ...&group_id=86244 Mark. |
|
#3
|
||||
|
||||
|
Ah, magic; had I found that first, I might have used it instead of making my own. Then again, it's always fun and educational trying to roll your own solution
![]() It's quite frustrating coming from Perl to Python in this respect; I find Python much nicer to code with, but the standard library is missing some really useful and time saving features found in Perl's CPAN. |
|
#4
|
||||
|
||||
|
Yeah i gotta agree with you there, def loadsa fun! The thing you have to remember though is that where the vaults of parnassus are pretty small.. CPAN is backed by Sun
.. and with that much comercial input what can you expect!http://www.vex.net/parnassus/ Give it a little time and see what happens .. Pythons becoming more popular every day.. but if parnassus hasn't grown considerably within the next 5 years where gonna have to make our own CPAN style resource for Python!Mark. |
|
#5
|
||||
|
||||
|
Yers, I think Parnassus and Python are just young, or rather they haven't been in the limelight and haven't had as many "3rd party" developers making good modules for it for as long.
The PDO project does look very promising, though in a way it'd be nice if they made it as similar as possible to the Perl DBI system, which is also AFAIK similar to something in C. |
|
#6
|
||||
|
||||
|
def, just wait till Python hits the big screen, and i know it will eventually
![]() Yeah, would be nice if we could keep the DBI the same (or as close as poss) for all/most langs, this way if you know DBI in one you know it in the other ![]() Mark. |
|
#7
|
|||
|
|||
|
Parnassus is old and crappy. PyPi <http://www.python.org/pypi> is a much better alternative.
|
|
#8
|
||||
|
||||
|
Yeah id agree with you strike but there are still allot of modules missing from PyPi (which is allot smaller than Parnassus)
Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > New database interface |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|