473,763 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2472
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********@gmai l.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.__fil e__
'/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.__fil e__
'/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

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

Similar topics

7
4842
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. OT: I'm also looking for books and websites for cross platform XHTML and DHTML.
41
2229
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 them". I absorbed this mantra and tell this to other people and I fully believe in it. However, I was talking to someone recently and he was saying how much he loved goto statements and how useful they were and that Microsoft had to leave them...
14
2144
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 assumption is wrong, then nevermind! :) But if it's true, what will be necessary to run these programs on a Mac, for example? I know they would need an equivalent to the .NET Framework, but does something like this exist yet, or is the "platform...
23
2297
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 as fast as one block can fall, and the next to be determined. Generating different numbers in one spur can work, but people can play Tetris for hours (or even days), and so you can't predict how long. You could constantly be making more with the...
0
6682
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, and started using the Microsoft Platform SDK for XP SP2, the errors disappeared, but I am now getting numerous warnings (macro redefinitions) as follows: StdAfx.cpp WINVER not defined. Defaulting to 0x0502 (Windows Server 2003) C:\Program...
28
2748
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 platform (e.g. Windows XP SP2). Now I am researching how to build my code for 64-bit platform (e.g. Windows 2003 Server 64-bit R2)? Any options I need to specify in Visual Studio 2005? The best solution to me is to make a single build for both 32-bit...
1
7825
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 must share the same endian format. Redo log files and control files from the source database are not transported to destination database . New control files and redo log files are created for the new database during the transport process, and an ...
4
2369
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 then ship them out for most cases but some of our customers do provide their own machines.) Our concern is if somebody takes one of our machines and ghosts it so they have a complete copy of the machine, it will allow them to continue working. We...
20
7767
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), firstly so I can use my favourite text editor (ConTEXT) which is only available for windows and secondly because I've never used a Mac before. But what do you think is the best all round development platform that I should use as a Web Developer?...
2
1962
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 through the Microsoft Visual Stuido Development Environment (IDE). I want to automate the process of using the Platform Builder. So far, I only know how to use the Platform Builder through the IDE. I want to use the Platform Builder through another...
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.