Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3 and mysql through SQLAlchemy

Currently:

  • SQLAlchemy installed and working (or at least import v0.8.0b2)
  • Mysql (v5.5.16)
  • Distribute (0.6.34)
  • Oracle mysql-python connector
  • Python 3.2
  • Windows 7 32/64 (note that I installed Python 32bits)

The problem is that MySQLdb or Oursql is required and I didn't managed to get any of them working.

Found this but didn't manage to get it working neither.

Edit: If you are aware of an other orm that works with Python3, I'm interested.

like image 467
martinqt Avatar asked Jan 04 '13 20:01

martinqt


People also ask

Can I use MySQL with SQLAlchemy?

SQLAlchemy supports MySQL starting with version 5.0. 2 through modern releases, as well as all modern versions of MariaDB.

Does SQLAlchemy work Python 3?

In order to use SQLAlchemy 2.0, the application will need to be runnable on at least Python 3.6 as of this writing. SQLAlchemy 1.4 now supports Python 3.6 or newer within the Python 3 series; throughout the 1.4 series, the application can remain running on Python 2.7 or on at least Python 3.6.

Is SQLAlchemy same as MySQL?

SQLAlchemy provides a nice “Pythonic” way of interacting with databases. So rather than dealing with the differences between specific dialects of traditional SQL such as MySQL or PostgreSQL or Oracle, you can leverage the Pythonic framework of SQLAlchemy to streamline your workflow and more efficiently query your data.

Is SQLAlchemy good for ETL?

One of the key aspects of any data science workflow is the sourcing, cleaning, and storing of raw data in a form that can be used upstream. This process is commonly referred to as “Extract-Transform-Load,” or ETL for short.


1 Answers

For others who arrive here, this should do it:

  • pip install mysql-connector==2.1.4 # version avoids Protobuf error
  • URI = 'mysql+mysqlconnector://$USER:$PASS@$HOST/$DB'
like image 116
Fletch F Fletch Avatar answered Oct 24 '22 18:10

Fletch F Fletch