By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

Out of the box database support

P: n/a
Hey there.

I was wondering whether Python had any support out-of-the-box for
database functionality, or database-like functionality.

For instance a lot of shared hosts have Python installed, but not the
MySQL extension, the flexible of these would install it, but most of
the time they wouldn't bother.

I was really looking for something like SQLite which ships bundled
with PHP these days. Or any standard way of connecting to generic
databases out of the box, i.e. MySQL.
Thanks for reading.
Alex Biddle.
Jul 3 '06 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Alex Biddle <he*******@gmail.comwrote:
Hey there.

I was wondering whether Python had any support out-of-the-box for
database functionality, or database-like functionality.

For instance a lot of shared hosts have Python installed, but not the
MySQL extension, the flexible of these would install it, but most of
the time they wouldn't bother.

I was really looking for something like SQLite which ships bundled
with PHP these days. Or any standard way of connecting to generic
databases out of the box, i.e. MySQL.
Python 2.5's standard library includes pysqlite. For any other DB, or
any previous release of Python, you need separate downloads.

Of course, shared hosts that are too lazy (and uninterested in
supporting Python) to perform a 20-seconds download and install, will
hardly be upgrading to Python 2.5 in the next 20 years or so, therefore
I doubt that pysqlite becoming part of the standard library is of any
help to the problem you have stated (in the "for instance" paragraph).
Alex
Jul 3 '06 #2

P: n/a
Ah, so separate downloads then. At least now I know.

Ergh... I checked the version of Python my current host is running and its 2.2.

....ergh....

On 7/3/06, Alex Martelli <al***@mac.comwrote:
Python 2.5's standard library includes pysqlite. For any other DB, or
any previous release of Python, you need separate downloads.

Of course, shared hosts that are too lazy (and uninterested in
supporting Python) to perform a 20-seconds download and install, will
hardly be upgrading to Python 2.5 in the next 20 years or so, therefore
I doubt that pysqlite becoming part of the standard library is of any
help to the problem you have stated (in the "for instance" paragraph).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Jul 3 '06 #3

P: n/a
On 7/3/06, Paul McGuire <pt***@austin.rr._bogus_.comwrote:
"Alex Biddle" <he*******@gmail.comwrote in message
news:ma***************************************@pyt hon.org...
Hey, thanks for the reply Jean-Paul.

That's pretty cool knowing that Python 2.5 will have it out of the
box, however what about basic out-of-the-box functionality in 2.4 (or
even older)?

In all my other experiences Python comes with a lot of tools already
available, it seems odd not to have basic database functionality
installed as default.

Would you like a pony with that? pysqlite *is* available today, and is not
overly onerous to install or bundle with your own package. And on the near
horizon, we see that it *will* be part of the included batteries, so
separate installation is only a temporary nuisance.

But there is another database battery available in current Python versions.
Try this:

import bsddb
No SQL support, instead this gives you a dict-like access to the database
(values must be strings, so you have to serialize columns into something
like XML, JSON, YAML, etc.):

import bsddb
db = bsddb.hashopen("testdb.db")
db["Paul"]="""<user name="Paul" id="12345"/>"""
db["Alex"]="""<user name="Alex" id="12346"/>"""
print db.keys()
del db["Paul"]
print db.keys()
db.close()


Thanks for the info. No thanks for the smarmy "pony" comment. I can't
install my own version because I'm on a shared server, of course
ideally I wouldn't like to be.
On 7/3/06, Shane Hathaway <sh***@hathawaymix.orgwrote:
Alex Biddle wrote:
Ah, so separate downloads then. At least now I know.

Ergh... I checked the version of Python my current host is running and its 2.2.

...ergh....

This is why you really want a VPS (virtual private server). The cost is
similar to a web host but you get to choose your own technologies and
versions. Several companies come to mind:

http://westhost.com/
http://jvds.com/
http://linode.com/

I'm using Westhost, which provides Python 2.2 if you ask for it, but I
compiled Python 2.4 instead. I didn't even have to ask whether I was
allowed to do that. :-)

Shane

Yeah, ideally a VPS would be the way to go. In the US hosting seems to
be cheaper than here in the UK, I don't know why. If I was going to
make a Python web app then I would go VPS, nowadays though I just make
do with PHP.
On 3 Jul 2006 09:45:35 -0700, BartlebyScrivener <rp*******@gmail.comwrote:
I guess you looked here without finding what you want?

http://www.python.org/doc/topics/database/

What's the big deal with "out of the box"? People have different tastes
in dbs and ways to access them, why not just pick the one you want and
download it?

You didn't say if you are on Linux or Windows. The ODBC module comes
with PythonWin. Others have good luck with mxODBC, which works right
out of the box after you download and install it.
The big deal with "out of the box" is that if it had support from the
outset for MySQL then Python could appeal to the mass market of people
who go for cheap-o hosts that can't be bothered to upgrade Python let
alone install databasefoo support. Currently this market is more or
less solely occupied by PHP.

Yes... I have installed MySQL support etc. on my local Linux server
but I /can't/ do that on a shared hosting environment.
Searching the group will tell you all you need to know on this topic,
as it comes up twice a week.
For what it's worth, I did try searching, but I guess my parametres
were the wrong ones. If it comes up twice a week, perhaps its a case
of demand and supply anyway?
Jul 3 '06 #4

P: n/a
Thanks for the info. No thanks for the smarmy "pony" comment.

Do you really want "smarmy" here? I don't think it works. Don't you
mean "flip" or "smart-alecky" or "facetious"?

Websters 3rd Unabridged
Main Entry:smarmy
Function:adjective
Inflected Form:-er/-est

1 : SLEEK *smarmy-headed David Walker*
2 : unctuously or fulsomely flattering : SLOBBERY, GUSHING, OILY,
INSINUATING "young man with the smarmy voice"--Noel Coward; "coy and
smarmy"-- Bernard Hollowood; "smarmy insincerity" Eric Partridge; "a
smarmy little melody"--Time

rd

Jul 4 '06 #5

P: n/a
BartlebyScrivener wrote:
Thanks for the info. No thanks for the smarmy "pony" comment.

Do you really want "smarmy" here? I don't think it works. Don't you
mean "flip" or "smart-alecky" or "facetious"?
Hmm. I think the word we're looking for here is "snarky". ;-)

Although, I confess to ignorance on what a "snark" is or whether
it is particularly known for brief self-consciously clever sarcastic
responses.

I sympathize with the shared-hosting problem, that's a major pain.
I would say 'go find a virtual private hosting service', but my
batting average is not so good with actual companies on that. I had
one that was pretty decent, but then went out of business and now
I'm with one that has rather poor-to-mediocre support and has been
extraordinarily slow ("VPSLand", BTW). I don't suppose anyone has
better options? I was looking for somebody that would let me run
Debian on a VPS.

Cheers,
Terry

--
Terry Hancock (ha*****@AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com

Jul 4 '06 #6

P: n/a
Terry Hancock <ha*****@anansispaceworks.comwrote:
...
Although, I confess to ignorance on what a "snark" is or whether
http://www.gutenberg.org/etext/13
Alex
Jul 4 '06 #7

P: n/a
Alex Martelli wrote:
http://www.gutenberg.org/etext/13
Leave it to the guy who can quote Borges and The Celestial Emporium of
Benevolent Knowledge while explaining multiple inheritance.

See Cookbook 2nd Ed pg. 234

Jul 4 '06 #8

P: n/a
BartlebyScrivener <rp*******@gmail.comwrote:
Alex Martelli wrote:
http://www.gutenberg.org/etext/13

Leave it to the guy who can quote Borges and The Celestial Emporium of
Benevolent Knowledge while explaining multiple inheritance.

See Cookbook 2nd Ed pg. 234
<bow>...;-)
Alex
Jul 4 '06 #9

P: n/a
Do you really want "smarmy" here? I don't think it works. Don't you
mean "flip" or "smart-alecky" or "facetious"?

Hmm. I think the word we're looking for here is "snarky". ;-)

Although, I confess to ignorance on what a "snark" is or whether
it is particularly known for brief self-consciously clever sarcastic
responses.

I sympathize with the shared-hosting problem, that's a major pain.
I would say 'go find a virtual private hosting service', but my
batting average is not so good with actual companies on that. I had
one that was pretty decent, but then went out of business and now
I'm with one that has rather poor-to-mediocre support and has been
extraordinarily slow ("VPSLand", BTW). I don't suppose anyone has
better options? I was looking for somebody that would let me run
Debian on a VPS.

Cheers,
Terry
Thanks for the considerate reply, it is annoying being stuck on a
shared server.
Thanks for the info. No thanks for the smarmy "pony" comment.

Do you really want "smarmy" here? I don't think it works. Don't you
mean "flip" or "smart-alecky" or "facetious"?
>From some Internet dictionary:
Smarmy:
1. Hypocritically, complacently, or effusively earnest; unctuous. See
Synonyms at unctuous.
2. Sleek.

I was aiming specifically towards the "effusively earnest" I don't
think that's a bad word to describe "would you like a pony with that
too?"

Anyway, the first time I read replies to my message I chuckled. It's
like the stereotypical intellectual debate, if you don't like the
message then focus on the detail.

The message in this case was that I /couldn't/ install anything by
myself as it is on a /shared/ server that's why I wanted to know
whether there was anything out of the box I could use.

Of course I would install all the "ponies" I wanted given I had proper
privileges to the machine.
Jul 4 '06 #10

P: n/a
Alex Biddle wrote:
The message in this case was that I /couldn't/ install anything by
myself as it is on a /shared/ server that's why I wanted to know
whether there was anything out of the box I could use.
but you did search the library reference TOC and/or the index for "database" before
you posted, and found that the "persistent dictionary" stuff in there weren't databasish
enough, right ?

</F>

Jul 4 '06 #11

P: n/a
Yes, I searched but couldn't find anything. Maybe I wasn't searching
for the right things / in the right places.

I admit I'm more used to forums than mailing lists, but I always make
some effort to search.

On 7/4/06, Fredrik Lundh <fr*****@pythonware.comwrote:
but you did search the library reference TOC and/or the index for "database" before
you posted, and found that the "persistent dictionary" stuff in there weren't databasish
enough, right ?
Jul 4 '06 #12

P: n/a
Alex Martelli wrote:
Terry Hancock <ha*****@anansispaceworks.comwrote: ...
Although, I confess to ignorance on what a "snark" is or whether

http://www.gutenberg.org/etext/13
"The Hunting of the Snark" by Lewis Caroll

Of course! I've heard of it, but never read it. Thanks, Alex. :-)

Not sure if it's relevant, yet, but no doubt I will be edified by
the experience in any case. I've enjoyed everything else by
Caroll that I've read.

Cheers,
Terry

--
Terry Hancock (ha*****@AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com

Jul 4 '06 #13

P: n/a
In article <ma***************************************@python. org>,
Terry Hancock <ha*****@anansispaceworks.comwrote:
>
I sympathize with the shared-hosting problem, that's a major pain. I
would say 'go find a virtual private hosting service', but my batting
average is not so good with actual companies on that. I had one that
was pretty decent, but then went out of business and now I'm with one
that has rather poor-to-mediocre support and has been extraordinarily
slow ("VPSLand", BTW). I don't suppose anyone has better options? I
was looking for somebody that would let me run Debian on a VPS.
http://www.panix.com/corp/virtuals/vservers.html

Unfortunately, it's not being as well advertised as it should be, but
Panix is definitely one of the class operators.
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

"I saw `cout' being shifted "Hello world" times to the left and stopped
right there." --Steve Gonedes
Jul 6 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.