![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Python With MySQL
Have any of you had experience with it? What are your takes on this combination?
I've heard there is PySQL, is that any different than MySQL with Python? What is the performance drop when using MySQL with Python, as opposed to MySQL with PHP? And finally, is there a way to embed your MySQL database and client in to the Python Py2exe Executable, so a user does not need to install a separate MySQL client program in order to use your Python Application? Wooh. Many questions off my shoulders. Thanks in advance. |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I've been planning to mess with it, but haven't. If you get there first, let us know. I doubt there would be much performance drop in a pro application, as the secret to speed in enterprise-sized apps is to let the DB do the grunt work and just handle the results.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
There are also python modules that map objects to databases (Object Relational Mappers, ORMs). The two I know are SQLObject, and SQLAlchemy. They both work with multiple databases on the back end (MySQL, PostgreSQL, etc.), and they handle all the SQL querying for you. You just define your classes and off you go. I have used SQLObject in turbogears, and it was pretty cool. I believe they also have the option to create hand tuned queries if you wish to increase performance.
|
|
|
|
|
|
#4 |
|
Programmer
|
I have used the MySQLdb module. It's s straightforward SQL-centric module complying with the pyhon DB API 2. It works for me.
No idea about performance |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 3
![]() |
I've been playing with Turbogears, which uses SQLObject. I love it- an ORM makes DB programming so much easier! As to performance, it seems fast enough; I haven't benchmarked it.
EDIT: SQLObject uses MySQLdb to talk to MySQL.
__________________
:wq |
|
|
|
|
|
#6 | ||
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Quote:
In terms of performance, Python should outperform PHP, given the same platform (i.e. if you're using mod_php under Apache, a fair test would use mod_python), as PHP is interpreted (IIRC), and Python is internally compiled into bytecode before execution, which, in general, tends to operate somewhat faster than a straight AST. That said, I'd imagine all the PHP MySQL library is codedentirely in C or C++, whilst the Python library is partially coded in Python. I'd imagine the difference between them would be small, but it would be interesting to run some speed tests. Quote:
|
||
|
|
|
|
|
#7 | |
|
Hobbyist Programmer
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 3
![]() |
Quote:
__________________
:wq |
|
|
|
|
|
|
#8 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Quote:
In such a case, SQLite seems the favoured option. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MySQL with python? | snipertomcat | Python | 2 | Apr 13th, 2006 1:34 AM |
| [tutorial] Python for programming beginners | coldDeath | Python | 30 | Dec 14th, 2005 11:35 AM |
| Convert Python script to C++ code | clanotheduck | Python | 17 | Sep 25th, 2005 8:55 AM |
| Advanced Python Tricks | Arevos | Python | 19 | Sep 24th, 2005 7:39 AM |
| Python - A Programmers Introduction | coldDeath | Python | 17 | Aug 19th, 2005 12:41 PM |