Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 30 of 208 Next 30 Older Entries

Displaying posts with tag: work (reset)

MySQL Connector/Python v1.2.1 RC
Employee +0 Vote Up -0Vote Down

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

  [Read more...]
Snippet: Fetching results after calling stored procedures using MySQL Connector/Python
Employee +3 Vote Up -0Vote Down

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

  [Read more...]
MySQL Connector/Python v1.1.6 GA
Employee +0 Vote Up -0Vote Down

This week we released MySQL (http://www.mysql.com" target="_blank) 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
Employee +0 Vote Up -0Vote Down

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.

MySQL Connector/Python v1.1.4 GA
Employee +0 Vote Up -0Vote Down

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
  [Read more...]
MySQL Connector/Python v1.1.3 beta
Employee +0 Vote Up -0Vote Down

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
Employee +1 Vote Up -0Vote Down

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,
  [Read more...]
MySQL Fabric support in Connector/Python
Employee +0 Vote Up -0Vote Down

MySQL Fabric was officially introduced during Tomas his keynote at MySQL Connect 2013. MySQL Fabric will help you managing lots of MySQL server supporting both high-availability and sharding. Just like Connector/J, MySQL Connector/Python v1.1.1 Alpha has support for MySQL Fabric on MySQL Labs. Note that the MySQL Fabric as well as support for it in Connector/Python is Alpha.

When you download MySQL Connector/Python from MySQL Labs, you will also see a ZIP

  [Read more...]
MySQL Connector/Python v1.1.1 alpha: With Pooling and Django!
Employee +1 Vote Up -0Vote Down

Connector/Python v1.1.1 is available for testing. It’s the second of a series of alpha releases which will bring some new features. Check out the Change History if you want to keep up with what is being added and changed.

Notable changes for v1.1.1:

Connector/Python v1.1.1 is alpha and although in good shape, it’s advised not to use it

  [Read more...]
MySQL Connector/Python v1.0.12 released
Employee +2 Vote Up -0Vote Down

A few weeks ago we released MySQL (http://www.mysql.com) Connector/Python v1.0.12. Bugs were fixed, and LOAD DATA LOCAL INFILE should now work correctly. The announcement can be read on the MySQL forums.

Some useful links:

  [Read more...]
MySQL Connector/Python v1.1.0 alpha
Employee +2 Vote Up -0Vote Down

Finally, Connector/Python v1.1.0 is out. It’s the first of a series of alpha releases which will bring some new features. Check out the Change History if you want to keep up with what is being added and changed.

Notable changes for v1.1.0:

  • Connector/Python v1.0 was known to work with Python v2.4 and 2.5. We now break compatibility with these older Python versions.
  • MySQL Prepared Statements are supported using cursor.MySQLCursorPrepared.
  • You can find out whether there is an ongoing transaction by checking
  [Read more...]
MySQL Connector/Python 1.0.10 available for download
Employee +5 Vote Up -0Vote Down

Last week we released MySQL (http://www.mysql.com) Connector/Python v1.0.10. Release notes can be found in the MySQL Developver Zone.

A notable fix in Connector/Python v1.0.10 which might interest a few users is adding support for LOAD DATA LOCAL INFILE. It allows you to import CSV using a simple SQL statement.

Please use the MySQL Bugs website to report any problem.

Some useful links:

  • Documentation:
  [Read more...]
Using Connector/Python with SQLAlchemy
Employee +4 Vote Up -0Vote Down

SQLAchemy has support for MySQL Connector/Python for a while now. Here is a little HOWTO showing how install both, and setup a database engine.

There are multiple ways of installing both projects, but here is the simplest using pip, whatever platform you use:

shell> pip install SQLAlchemy
shell> pip install mysql-connector-python 

Start your SQLAlchemy engines using a URL pointing to Connector/Python. Note the connect_args argument which passes extra connection arguments to Connector/Python. In the

  [Read more...]
MySQL Connector/Python 1.0.9 available for download
Employee +1 Vote Up -0Vote Down

Today we released MySQL (http://www.mysql.com) Connector/Python v1.0.9. Release notes can be found in the MySQL Developver Zone.

Connector/Python v1.0.9 contains some important fixes, especially for the Windows platform. It also comes with a new connection argument called force_ipv6, and can be used to force IPv6 when an address resolves to both IPv4 and v6. Also, RPM packages have been made available in addition to the TAR/ZIP and MSI packages.

Please use the MySQL Bugs website to report any problem.

Some useful links:

  • Documentation:
  [Read more...]
Change management of database scripts
+1 Vote Up -0Vote Down
In this post I’m going to discuss the strategy used by our team to manage the changes taking place in the database. Most of the time we as developers mainly focus on implementing the feature and put less effort on manage the database changes. For instance individual might not straight away see the importance in […]
MySQL Connector/Python 1.0.8 available for download
Employee +1 Vote Up -0Vote Down

Last week we made a maintenance release for MySQL Connector v1.0 available. The announcement can be read in the MySQL forums and the history log is available online.

Connector/Python v1.0.8 does not introduce anything new, it only comes with bug fixes. Some are quite important and it’s probably good to upgrade.

Please use the MySQL Bugs website to report any problem.

Some useful links:

  [Read more...]
MySQL Connector/Python v1.0 goes GA!
Employee +1 Vote Up -0Vote Down

Today, during MySQL Connect 2012 keynote, the General Availability of MySQL Connector/Python 1.0 was announced! This is the first GA release of Oracle’s pure Python database driver for MySQL.

MySQL Connector/Python v1.0 works with MySQL 5.5 and 5.6, but older versions of the MySQL servers are known to work. For Python, version v2.6, v2.7 and v3.1 and greater are officially supported. Python v2.4/2.5 are know to work as well.

As always, we welcome your feedback and questions through our bug system or using the MySQL Python forum.

Some useful links:

  • Documentation:
  [Read more...]
Talking about Python at MySQL Connect 2012
Employee +1 Vote Up -0Vote Down

Love Python? Dig MySQL (http://www.mysql.com" target="_blank)? Want to meet Oracle’s MySQL Python Experts?

Come and join us at the MySQL Connect 2012 conference in San Fransisco next week, 29/30 September. My colleague Chuck and I are both giving 3 sessions in which we discuss MySQL Utilities and Connector/Python.

Overview of our session:

  [Read more...]
MySQL Connector/Python v1.0.6 beta available
Employee +3 Vote Up -0Vote Down

We released the second beta of MySQL Connector/Python v1.0. You can download v1.0.6 from the MySQL website and the change history can be found in the online manual.

Usually, beta releases do not have big changes, but we had to push some code which did not make the previous one and it really had to go into v1.0. The exceptions raised by Connector/Python are now mapped against the ‘SQLState’ found in the MySQL server errors. This makes it much easier to maintain and clearer which exception

  [Read more...]
Fetching rows as dictionaries with MySQL Connector/Python (revised)
Employee +4 Vote Up -0Vote Down

It is possible with MySQL Connector/Python to define your own cursor classes. A very good use case is to return rows as dictionary instead of tuples. This post shows how to do this using MySQL Connector/Python v1.0 and is an update for an older blog entry.

In the example below we are subclassing the MySQLCursor class to create a new class called MySQLCursorDict. We change the _row_to_python() method to return a dictionary instead of a tuple. The keys of the dictionary will be (unicode) column names.

from pprint import pprint
import mysql.connector

class MySQLCursorDict(mysql.connector.cursor.MySQLCursor):
    def _row_to_python(self, rowdata, desc=None):
        row
  [Read more...]
MySQL Connector/Python Launchpad entry updated
Employee +6 Vote Up -0Vote Down

We finally got the MySQL Connector/Python repositories reorganised on Launchpad. The following changes have been made:

  • Old, unmaintained repositories have been marked as obsolete.
  • Downloadable source distributions of obsolete versions have been removed, use the MySQL download website.
  • Connector/Python v1.0 source has been uploaded to Launchpad up till v1.0.5b1.
  • URLs point to the MySQL website.
  • Maintainer is now ‘Oracle/MySQL Engineering’, the team I (Geert Vanderkelen) am part of.
Linus on Instantiation and Armadaification
+0 Vote Up -1Vote Down

I feel a sense of pride when I think that I was involved in the development and maintenance of what was probably the first piece of software accepted into Debian which then had and still has direct up-stream support from Microsoft. The world is a better place for having Microsoft in it. The first operating system I ever ran on an 08086-based CPU was MS-DOS 2.x. I remember how thrilled I was when we got to see how my friend’s 80286 system ran BBS software that would cause a modem to dial a local system and display the application as if it were running on a local machine. Totally sweet.

When we were living at 6162 NE Middle in the nine-eight 292, we got an 80386 which ran Doom. Yeah, the original one, not the fancy new one with the double barrel shotgun, but it would probably run that one, too.

  [Read more...]
MySQL Connector/Python 1.0.5 beta available through PyPI
Employee +4 Vote Up -0Vote Down

Yesterday we announced the availability of MySQL Connector/Python v1.0.5 beta. Today I’ve made it available on PyPI so it can be easily installed. Note that I did remove the old development release and when you upgrade or try v1.0.5, you should check the ChangeLog.

shell> pip install mysql-connector-python

For those wondering why the name includes ‘python’: it’s just to align it with other MySQL connectors and to keep the name consistent with other distribution types.

We welcome and appreciate feedback and comments for this first beta release through the

  [Read more...]
MySQL Connector/Python v1.0.5 beta available for download
Employee +1 Vote Up -0Vote Down

MySQL Connector/Python v1.0.5 beta is now available for download from the MySQL website. This version is feature complete and we welcome and appreciate feedback and bug reports.

We’re also interested in hearing your feedback for future enhancements. Let us know how you’re using the connector too, especially if you are using it with Django, SQLAlchemy and similar Python technologies.

A few things have changed since the last development releases and we hope the manual shipping with the Connector/Python distribution (and also available online soon) will help you get up to speed.

Here are a few important changes that might be incompatible with current scripts using the now obsolete development

  [Read more...]
Naming a Python package for distribution?
Employee +0 Vote Up -0Vote Down

I’m currently figuring out how to name the MySQL Connector/Python distributions so it works well with PyPi. Source archives would be named like mysql-connector-python-X.Y.Z.tar.gz.

The ‘name’ metadata would be ‘MySQL Connector Python’, thus without any underscores or dashes. This works OK, but if people have objections, please leave a comment.

NIST::NVD::Store::SQLite3 1.00.00
+0 Vote Up -0Vote Down

It’s been released. Use this with NIST::NVD 1.00.00 and you will be able to perform immediate look-ups of CVE and CWE data given a CPE URN. For instance:

cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ perl Makefile.PL ; make ; make test ; cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ perl -MNIST::NVD::Query -MData::Dumper -e '
$q = NIST::NVD::Query->new(store    => q{SQLite3},database => q{t/data/nvdcve-2.0.db});
$cve_list = $q->cve_for_cpe( cpe => q{cpe:/a:microsoft:ie:7.0.5730.11} );
print Data::Dumper::Dumper { cve_list => $cve_list, first_cvss => $q->cve( cve_id => $cve_list->[0] )->{q{vuln:cvss}} }
'
$VAR1 = {
          'cve_list' => [
                          'CVE-2002-2435',
                          'CVE-2010-5071'
                        ],
          'first_cvss' => {
  [Read more...]
NIST::NVD 1.00.00
+0 Vote Up -0Vote Down

I’m leaving myself some room for bug fixes. It works for us in house. I would love to help others to give it a try. especially those who could benefit from making nearly immediately answered queries to the NIST’s NVD database.

The code in this release cannot by itself track the feed from the feds in real time. The nvd entry loader needs a little bit of love in the area of record merging before this starts working. It’s on my TODO list.

I’m sorry for the outage of git.colliertech.org. I’ll get that back up here shortly. In the meantime, feel free to grab it from this location while the CPAN indexes and processes my submission.

http://www.colliertech.org/federal/NIST/NIST-NVD-1.00.00.tar.bz2

don’t forget to check the cryptographic signature:

  [Read more...]
Bootstrapping & Running MySQL server standalone on Windows
Employee +1 Vote Up -0Vote Down

Two extra tips when you try to (manually) bootstrap MySQL on Windows from the command line:

  • When bootstrapping, use --no-defaults or --defaults-file.
  • Use --standalone when starting the MySQL server.
  • The first point really bugged me yesterday. I’m used to installing MySQL manually and having no option files available where MySQL would read them by default.

    On Windows, however, I used the MySQL installer. So, when I launch unit testing for Connector/Python it bugged me saying log files of InnoDB didn’t match the configuration. This is indeed a newbie error..

    Invalid dates returning None, or raise error using Connector/Python?
    Employee +0 Vote Up -0Vote Down

    In this blog we discuss invalid dates in MySQL (http://www.mysql.com" target="_blank), how to retrieve them using Connector/Python and we raise the question: Should Connector/Python raise an error or just keep returning None on invalid dates?

    If you run MySQL without proper SQL Modes, you will be able to update and
    read invalid dates such as ’2012-06-00′. If you’ve payed attention the past decade, you’ll know that you can prevent this configuring your MySQL server setting SQL Mode to ‘TRADITIONAL’.

    Now, the problem if this is allowed, how do we get invalid dates using MySQL Connector/Python?

    Lets look at an example inserting an invalid date and trying to read


      [Read more...]
    Monitoring and Managing Amazon RDS Databases using MySQL Workbench
    +0 Vote Up -0Vote Down
    Last couple of week I was looking for an easier approch to manage the Databases created on Amazon RDS instances. I had to run through a tedious set of steps in carrying out routine stuff like introducing new updates, taking daily backups and moving it to an Amazon S3 bucket, etc… Before getting into touch […]
    Showing entries 1 to 30 of 208 Next 30 Older Entries

    Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.