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

Truly platform-independent DB access in Python?

Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent - I need a module not included in Python by
default - python-mysql, and it uses a compiled binary _mysql.so. So it
is not platform-independent because for each web-server on different
platform, I would have to download it and extra compile it specifically
for that platform. Do you know of any Python solution for MySQL access
that is 100% platform-independent?

Thanks for any suggestions.
Boris Dušek

Aug 28 '06 #1
16 2421
bobrik wrote:
I am using the Python DB API for access to MySQL. But it is not
platform-independent - I need a module not included in Python by
default - python-mysql, and it uses a compiled binary _mysql.so. So it
is not platform-independent because for each web-server on different
platform, I would have to download it and extra compile it specifically
for that platform. Do you know of any Python solution for MySQL access
that is 100% platform-independent?
Probably SqlAlchemy
http://www.sqlalchemy.org/

Lorenzo

Aug 28 '06 #2
lb********@gmail.com wrote:
bobrik wrote:
>I am using the Python DB API for access to MySQL. But it is not
platform-independent - I need a module not included in Python by
default - python-mysql, and it uses a compiled binary _mysql.so. So it
is not platform-independent because for each web-server on different
platform, I would have to download it and extra compile it specifically
for that platform. Do you know of any Python solution for MySQL access
that is 100% platform-independent?

Probably SqlAlchemy
http://www.sqlalchemy.org/
Probably not - I fail to see how SqlAlchemy could talk to MySQL without
the MySQL/Python binding.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Aug 28 '06 #3
bobrik wrote:
Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent
It is. You don't have to change your Python code according to the OS or
CPU.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Aug 28 '06 #4

borisI am using the Python DB API for access to MySQL. But it is not
borisplatform-independent - I need a module not included in Python by
borisdefault - python-mysql, and it uses a compiled binary
boris_mysql.so. So it is not platform-independent because for each
borisweb-server on different platform, I would have to download it and
borisextra compile it specifically for that platform. Do you know of
borisany Python solution for MySQL access that is 100%
borisplatform-independent?

I don't think you mean "platform-independent". I suspect you mean
"batteries included". Prior to the release of Python 2.5, no modules to
access SQL databases were distributed with core Python. Starting with 2.5,
sqlite access will be available:
>>import sqlite3
sqlite3.__file__
'/Users/skip/local/lib/python2.5/sqlite3/__init__.pyc'

So, if what you were really asking was "what SQL databases can I access
without installing any software other than Python?", then the answer is "No
SQL databases were distributed with Python prior to 2.5. Starting with
Python 2.5, access to sqlite databases is available by default." Python 2.5
is due out soon (according to PEP 356, on 12 September).

The still-officially-in-development-but-almost-certainly-frozen
documentation for the sqlite3 module is here:

http://docs.python.org/dev/lib/module-sqlite3.html

Skip
Aug 28 '06 #5

Bruno Desthuilliers wrote:
bobrik wrote:
Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent

It is. You don't have to change your Python code according to the OS or
CPU.
What I mean is that wiht platform-independent access, I should be able
to not care on which operating system is the web server accessing my
scripts where I use MySQLdb which I have to install (and therfore
platform-dependently) compile myself. The important point is that
MySQLdb is installed as an extra module. So you have to compile it
manually, but what if the OS with server accessing the site that is on
shared area changes?

Aug 28 '06 #6
sk**@pobox.com wrote:
I don't think you mean "platform-independent". I suspect you mean
"batteries included". Prior to the release of Python 2.5, no modules to
access SQL databases were distributed with core Python. Starting with 2.5,
sqlite access will be available:
>>import sqlite3
>>sqlite3.__file__
'/Users/skip/local/lib/python2.5/sqlite3/__init__.pyc'

So, if what you were really asking was "what SQL databases can I access
without installing any software other than Python?", then the answer is "No
SQL databases were distributed with Python prior to 2.5. Starting with
Python 2.5, access to sqlite databases is available by default." Python 2.5
is due out soon (according to PEP 356, on 12 September).
Yes, you excactly got my point. The thing is that I can't rely on
Python 2.5 to be installed soon.
So the only solution for me at this moment is to use jython and from
there use Java JDBC API (sorry :-) But it would be great if the Python
DB API compliant-modules would become parts of core python quickly.
Python DB API itself is a great thing.

Aug 28 '06 #7
Boris Dušek wrote:
So the only solution for me at this moment is to use jython and from
there use Java JDBC API (sorry :-)
so who installed Java for you?

</F>

Aug 28 '06 #8
>
Yes, you excactly got my point. The thing is that I can't rely on
Python 2.5 to be installed soon.
So the only solution for me at this moment is to use jython and from
there use Java JDBC API (sorry :-) But it would be great if the Python
DB API compliant-modules would become parts of core python quickly.
Python DB API itself is a great thing.
They won't be. The reason that sqlite is is because it is self-contained.
But your average DB itself you need to install using a platform-specific
build. And building the the extensions even requires proprietary libraries
installed (think of oracle) - so without having installed a dozen or more
DBs, no one could build python!

So - no chance that this will ever happen. The only thing you could do is to
try and convince the DB-vendors to provide pure python DB drivers - as they
do it for java.

Diez
Aug 28 '06 #9
Boris Dušek wrote:
Bruno Desthuilliers wrote:
>bobrik wrote:
>>Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent
It is. You don't have to change your Python code according to the OS or
CPU.
What I mean is that wiht platform-independent access, I should be able
to not care on which operating system is the web server accessing my
scripts where I use MySQLdb
When it comes to *using* MySQLdb, you don't care about the OS, CPU and
whatnot.
which I have to install (and therfore
platform-dependently) compile myself.
This is a very distinct problem.
The important point is that
MySQLdb is installed as an extra module. So you have to compile it
manually,
Usually, cd <src-dir&& python setup.py install do the job.
but what if the OS with server accessing the site that is on
shared area changes?
And what if Python is not installed on it ?-)

Seriously, do you think that hosting companies swap OS very often ?

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Aug 28 '06 #10

Bruno Desthuilliers wrote:
but what if the OS with server accessing the site that is on
shared area changes?

And what if Python is not installed on it ?-)

Seriously, do you think that hosting companies swap OS very often ?
No, I don't. But I was trying to find the best solution. :-)

Aug 28 '06 #11
Bruno Desthuilliers wrote:
Boris Dušek wrote:
>>Bruno Desthuilliers wrote:
>>>bobrik wrote:

Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent

It is. You don't have to change your Python code according to the OS or
CPU.

What I mean is that wiht platform-independent access, I should be able
to not care on which operating system is the web server accessing my
scripts where I use MySQLdb


When it comes to *using* MySQLdb, you don't care about the OS, CPU and
whatnot.

>>which I have to install (and therfore
platform-dependently) compile myself.


This is a very distinct problem.

>>The important point is that
MySQLdb is installed as an extra module. So you have to compile it
manually,


Usually, cd <src-dir&& python setup.py install do the job.

>>but what if the OS with server accessing the site that is on
shared area changes?


And what if Python is not installed on it ?-)

Seriously, do you think that hosting companies swap OS very often ?
Well, GoDaddy just switched enough domains from Linux to Windows to make
a significant difference to the Internet hosting statistics, and were
allegedly paid handsomely by Microsoft to do it, but those were parked
domains.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Aug 28 '06 #12

Dennis Lee Bieber wrote:
On 28 Aug 2006 00:01:06 -0700, "bobrik" <bo*********@gmail.com>
declaimed the following in comp.lang.python:

for that platform. Do you know of any Python solution for MySQL access
that is 100% platform-independent?
Subprocess module invoking the MySQL command line utilities? Of
course, parsing the results will be painful...
--
Wulfraed Dennis Lee Bieber KD6MOG
wl*****@ix.netcom.com wu******@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: we******@bestiaria.com)
HTTP://www.bestiaria.com/
Hmm, that is very interesting; and parsing won't be IMHO such a problem
if the columns will be tab-separated. Thanks for your tip!

Aug 28 '06 #13
"Boris Duek" <bo*********@gmail.comwrites:
Yes, you excactly got my point. The thing is that I can't rely on
Python 2.5 to be installed soon.
So the only solution for me at this moment is to use jython and from
there use Java JDBC API (sorry :-)
Assuming Java is installed on an arbitrary machine seems to be exactly
the sort of assumption you said you *don't* want to make.

How about this: Please lay out the assumptions you *are* willing to
make about the target platform, and what you want to do on that
platform.

--
\ "My classmates would copulate with anything that moved, but I |
`\ never saw any reason to limit myself." -- Emo Philips |
_o__) |
Ben Finney

Aug 29 '06 #14
Boris Dušek wrote:
Bruno Desthuilliers wrote:
>>but what if the OS with server accessing the site that is on
shared area changes?
And what if Python is not installed on it ?-)

Seriously, do you think that hosting companies swap OS very often ?

No, I don't. But I was trying to find the best solution. :-)
Is there any reason to find a solution for a non-yet-existing problem ?

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Aug 29 '06 #15
sk**@pobox.com wrote:
... snip ...
So, if what you were really asking was "what SQL databases can I access
without installing any software other than Python?", then the answer is "No
SQL databases were distributed with Python prior to 2.5. Starting with
Python 2.5, access to sqlite databases is available by default." Python 2.5
is due out soon (according to PEP 356, on 12 September).
So I finally decided to go with sqlite, compile the module myself for
the time being and hoping python will be upgraded to 2.5 at latest at
the same time as any potential OS (or architecture) upgrade.

Aug 31 '06 #16
On 28 Aug 2006 00:01:06 -0700, bobrik <bo*********@gmail.comwrote:
Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent - I need a module not included in Python by
default - python-mysql, and it uses a compiled binary _mysql.so. So it
is not platform-independent because for each web-server on different
platform, I would have to download it and extra compile it specifically
for that platform. Do you know of any Python solution for MySQL access
that is 100% platform-independent?
I'm sorry but since when is MySQL platform independent? if
mysql-python will be pure python then it will probably be slower
because it will have to use sockets, or other type of IPC instead Andy
used mysql C API which is fast.

on the other hand all big *NIX distros have mysql-python on their
packages/tree, and I made a windows installer of the last version,
which you can get from sourceforge.

so the only problem I see here is if your on a mac, on which the
source should compile without problems since it's *NIX now.

at this moment installing on any mayor platform is 2-3 commands/clicks away..
Thanks for any suggestions.
Boris Dušek

--
http://mail.python.org/mailman/listinfo/python-list
Aug 31 '06 #17

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

Similar topics

7
by: Web Master | last post by:
Are there any good websites or books that deal with cross platform XML? I'd like to target Internet Explorer/Netscape Navigator 5 or later, as well as Opera, possibly konqueror on Linux as well. ...
41
by: Mark R. Dawson | last post by:
I have never used a goto statement in my code, one of the first things I was told in my software classes a number of years ago was "goto statements are evil and lead to spagetti code - do not use...
14
by: John Salerno | last post by:
Bear with me, but I've been reading a lot about how the .NET languages are platform independent, and I assume this means a program written in C# can be run on a Unix or Mac machine. If this...
23
by: Alvin | last post by:
Well, I'm developing a Tetris game in SDL, but when it comes to deciding the next block, I'm stuck. It's random, but when I try something like seeding the randomizer with the time, it won't update...
0
by: marathoner | last post by:
I am currently migrating my Visual C++ 6.0 applications to Visual Studio 2005. I am getting compiler errors involving the VS2005's platform SDK. When I removed directory references to that SDK,...
28
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I am developing C++ COM native code (unmanaged C++) using Visual Studio 2005. I do not take any new features of 64-bit platform, and currently my code runs fine on 32-bit...
1
by: Vinod Sadanandan | last post by:
Cross Platform Migration An Unproblematic Approach (Windows-UNIX ) Oracle 10\11g The principal restriction on cross-platform transportable database is that the source and destination platform...
4
by: Mufasa | last post by:
I'm looking for a way to get a truly unique identifier for a machine for our client software. I'd like to have it so that there's little or no setup by the end user. (We set up the machines and...
20
by: macca | last post by:
Hi, I just started a new web developer job (my first actually) and the machine they gave me to use is a Mac. Two days in and I'm running a Win XP environment on my Mac at work (using VMWare), ...
2
xarzu
by: xarzu | last post by:
Platform Builder is a tool for building a Windows CE Operating system on your computer and then loading it on a Windows CE device. All this is done through Platform Builder. And I do it all...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.