Truly platform-independent DB access in Python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bobrik

    #1

    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

  • lbolognini@gmail.com

    #2
    Re: Truly platform-independent DB access in Python?

    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
    The Database Toolkit for Python


    Lorenzo

    Comment

    • Bruno Desthuilliers

      #3
      Re: Truly platform-independent DB access in Python?

      lbolognini@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 'onurb@xiludom. gro'.split('@')])"

      Comment

      • Bruno Desthuilliers

        #4
        Re: Truly platform-independent DB access in Python?

        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 'onurb@xiludom. gro'.split('@')])"

        Comment

        • skip@pobox.com

          #5
          Re: Truly platform-independent DB access in Python?


          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:



          Skip

          Comment

          • Boris Dušek

            #6
            Re: Truly platform-independent DB access in Python?


            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?

            Comment

            • Boris Dušek

              #7
              Re: Truly platform-independent DB access in Python?

              skip@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.

              Comment

              • Fredrik Lundh

                #8
                Re: Truly platform-independent DB access in Python?

                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>

                Comment

                • Diez B. Roggisch

                  #9
                  Re: Truly platform-independent DB access in Python?

                  >
                  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

                  Comment

                  • Bruno Desthuilliers

                    #10
                    Re: Truly platform-independent DB access in Python?

                    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 'onurb@xiludom. gro'.split('@')])"

                    Comment

                    • Boris Dušek

                      #11
                      Re: Truly platform-independent DB access in Python?


                      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. :-)

                      Comment

                      • Steve Holden

                        #12
                        Re: Truly platform-independent DB access in Python?

                        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

                        Comment

                        • Boris Dušek

                          #13
                          Re: Truly platform-independent DB access in Python?


                          Dennis Lee Bieber wrote:
                          On 28 Aug 2006 00:01:06 -0700, "bobrik" <boris.dusek@gm ail.com>
                          declaimed the following in comp.lang.pytho n:
                          >
                          >
                          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
                          wlfraed@ix.netc om.com wulfraed@bestia ria.com

                          (Bestiaria Support Staff: web-asst@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!

                          Comment

                          • Ben Finney

                            #14
                            Re: Truly platform-independent DB access in Python?

                            "Boris Duek" <boris.dusek@gm ail.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

                            Comment

                            • Bruno Desthuilliers

                              #15
                              Re: Truly platform-independent DB access in Python?

                              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 'onurb@xiludom. gro'.split('@')])"

                              Comment

                              Working...