Showing entries 11 to 20 of 227
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: work (reset)
MySQL Connector/Python on GitHub

Last week we released Connector/Python v2.0 (alpha); today we publish the source on GitHub. Yes, we are using Git internally and are now able to push it out on each release. Previous versions are still available through LaunchPad.

Here is the full process to get Connector/Python installed in a virtual environment. You’ll need Git installed of course.

shell> git clone https://github.com/oracle/mysql-connector-python.git cpy
shell> virtualenv ENVCPY
shell> source ENVCPY/bin/activate
(ENVCPY)shell> cd cpy
(ENVCPY)shell> python setup.py install
(ENVCPY)shell> python
>>> import mysql.connector
>>> mysql.connector.__version__ …
[Read more]
MySQL Connector/Python v2.0.0 alpha

A new major version of Connector/Python is available: v2.0.0 alpha has been been released and is available for download! As with any alpha-software, it’s probably not good to throw it in production just yet.

Our manual has the full change log but here’s an overview of most important changes for this relase.

Some incompatibilities

The world evolves, at least the software does, and Python is not different. I’m not as bold as the guys at Django who dropped support of Python v2.6 with the Django v1.7 release. I’m leaving it in because I’m nice.

Supported Python: 2.6 and 2.7 and 3.3 and 3.4

We do not …

[Read more]
MySQL Connector/Python v1.2.2 GA supporting MySQL Fabric

A few weeks ago MySQL Fabric got GA and shipped together with MySQL Utilities 1.4. Today, 2 weeks late, a tooth less and having fixed my website(s), I can blog about MySQL Connector/Python v1.2 going GA.

My previous post about the release candidate already summed up the important changes, and nothing changed since then except few bug fixes. Here are again the important new features/bugs fixed for Connector/Python v1.2:

  • Added support for MySQL Fabric.
  • Support for MySQL’s Authentication Plugins: mysql_clear_password and sha256_password are now supported over an SSL connection.
  • Failing over connections (note: not MySQL Fabric HA)

Of course, …

[Read more]
MySQL Connector/Python v1.2.1 RC

Monday 31 March 2014 proved to be a big day for MySQL with 5 announcements of products getting new releases: the next milestone release MySQL Server 5.7.4, MySQL Workbench 6.1 going GA and Connector/J 5.1.30 and MySQL Utilities 1.4.2 RC which include MySQL Fabric. That’s 4, the fifth being Connector/Python.

Connector/Python v1.2.1 has been released as Release Candidate. Check out the  …

[Read more]
Snippet: Fetching results after calling stored procedures using MySQL Connector/Python

Problem

Using MySQL Connector/Python, you are calling a stored procedure which is also selecting data and you would like to fetch the rows of the result.

Solution

For this example we create a stored procedure which is executing SHOW SLAVE STATUS.

cnx = mysql.connector.connect(user='scott', password='tiger',
                              database='mining')
cur = cnx.cursor()
cur.execute("DROP PROCEDURE IF EXISTS slave_status")
proc = "CREATE PROCEDURE slave_status () BEGIN SHOW SLAVE STATUS; END"
cur.execute()
cur.call("slave_status")

for result_cursor in cur.stored_results():
 for row in result_cursor:
   print(row[0])

The result from the above would be:

shell> python foo.py
Waiting for master to send event

Discussion

The stored_results() method of …

[Read more]
MySQL Connector/Python v1.1.6 GA

This week we released MySQL Connector/Python v1.1.6 has been released with a fix for the Django backend. If you  wonder (or not?) where Connector/Python v1.1.5, it got released a few weeks ago. Yes, PyPi has been updated! Don’t forget to use –allow-external using newest pip.

Some useful links:

[Read more]
Installing MySQL Connector/Python using pip v1.5

The latest pip versions will fail on you when the packages it needs to install are not hosted on PyPI. When you try to install MySQL Connector/Python the usually way, you get following message is:

shell> pip install mysql-connector-python
  Could not find any downloads that satisfy the requirement 
    mysql-connector-python
  Some externally hosted files were ignored 
    (use --allow-external mysql-connector-python to allow).

I have updated the download URL to include the MD5 checksum, and MySQL Connector/Python should now install using pip using following command:

shell> pip install --allow-external mysql-connector-python \
  mysql-connector-python

Yes, you have to repeat the mysql-connector-python name. …

[Read more]
MySQL Connector/Python v1.1.4 GA

It has been a busy week for the Pythonic MySQL Team at Oracle: MySQL Utilities 1.3.6 and a brand new Utilities 1.4.1 Alpha has been release which includes Fabric. Yes, and of course, the one binding them all: Connector/Python v1.1.4 has been released as GA (General Available). Check out the Change History if you want to keep up with what is being added and changed.

New features found in v1.1:

  • Important: Connector/Python will not work with Python v2.4 or v2.5. Yes, I consider this a feature.
  • Connector/Python comes with it’s own …
[Read more]
MySQL Connector/Python v1.1.3 beta

Connector/Python v1.1.3 is available for testing since last week. It is a “beta” release, so it would be great if we even get more feedback. Check out the Change History if you want to keep up with what is being added and changed.

Notable changes for v1.1.3 include a fix for encoding using \x5c or backslashes in multi-byte characters. We also made the code more PEP-8 compliant, which we think is quiet important.

Some useful links:

[Read more]
Snippet: Show column information using MySQL Connector/Python

Problem

You have a query executed by MySQL Connector/Python and would like to show column information nicely on the console.

Solution

Every cursor object has a description property. This can be used to show information about the columns in a result set.

columns = []
maxnamesize = 0
for coldesc in cur.description:
    coldesc = list(coldesc)
    coldesc[2:6] = []
    columns.append(coldesc)
    namesize = len(coldesc[0])
    if namesize > maxnamesize:
        maxnamesize = namesize

fmt = "{{nr:3}} {{name:{0}}} {{type:12}} {{null}}".format(
    maxnamesize+1)
colnr = 1
for column in columns:
    (colname, fieldtype, nullok, colflags) = column
    print(fmt.format(
        nr=colnr,
        name=colname,
        null='NOT …
[Read more]
Showing entries 11 to 20 of 227
« 10 Newer Entries | 10 Older Entries »