Re: [RFC] Python 3 and MySQL

2014-09-09 Thread Naoki INADA
I've fixed them and released mysqlclient 1.3.3.
https://pypi.python.org/pypi/mysqlclient

On Tuesday, September 9, 2014 3:29:45 PM UTC+9, Naoki INADA wrote:
>
> I've fixed `%(xxx)s` style formatting.
>
> I have not changed error switch:
> https://github.com/PyMySQL/mysqlclient-python/blob/master/_mysql.c#L150
> https://github.com/farcepest/MySQLdb1/blob/master/_mysql.c#L180
>
> I'll investigate the problem, but I can't promise any date for fixing it.
>
>
> On Tuesday, September 9, 2014 12:35:26 AM UTC+9, Claude Paroz wrote:
>>
>> On Monday, September 8, 2014 5:19:56 PM UTC+2, Naoki INADA wrote:
>>>
>>> On Mon, Sep 8, 2014 at 11:28 PM, Tim Graham <timog...@gmail.com> wrote: 
>>> > We'd need mysqlclient to support Python 3.2 (or drop official support 
>>> for 
>>> > MySQL/Python 3.2): 
>>>
>>> Python 3.3 introduces PEP 393 (Flexible String Representation) and 
>>> many Unicode API has 
>>> been changed and deprecated.  It also introduce unicode literal. 
>>> Supporting Python 3.2 will make code messy. 
>>>
>>> I want to drop Python 3.2 support since I believe most Python 3 users 
>>> are aggressive enough 
>>> to go forward. 
>>>
>>> How Python 3.2 important for you? 
>>>
>>
>> I think we could live with MySQL not supporting Python 3.2. 
>>
>> > Python 2.7 test failures: 
>>> > 
>>> > 
>>> > custom_pk.tests.CustomPKTests.test_required_pk 
>>> > fixtures.tests.FixtureLoadingTests.test_loaddata_error_message 
>>> > 
>>> generic_relations_regress.tests.GenericRelationTests.test_target_model_is_unsaved
>>>  
>>>
>>> > get_or_create.tests.GetOrCreateTests.test_get_or_create_invalid_params 
>>> > get_or_create.tests.UpdateOrCreateTests.test_integrity 
>>> > model_fields.tests.BooleanFieldTests.test_null_default 
>>>
>>
>> Thanks Tim for testing. These errors seem to all have the same origin, 
>> null inserts into not-null columns generate OperationalError instead of 
>> IntegrityError.
>>  
>>
>>> > Python 3.4 test failures: 
>>> > 
>>> > 
>>> > backends.tests.BackendTestCase.test_cursor_execute_with_pyformat 
>>> > backends.tests.BackendTestCase.test_cursor_executemany_with_pyformat 
>>> > 
>>> backends.tests.BackendTestCase.test_cursor_executemany_with_pyformat_iterator
>>>  
>>>
>>> > custom_pk.tests.CustomPKTests.test_required_pk 
>>> > fixtures.tests.FixtureLoadingTests.test_loaddata_error_message 
>>> > 
>>> generic_relations_regress.tests.GenericRelationTests.test_target_model_is_unsaved
>>>  
>>>
>>> > get_or_create.tests.GetOrCreateTests.test_get_or_create_invalid_params 
>>> > get_or_create.tests.UpdateOrCreateTests.test_integrity 
>>> > model_fields.tests.BooleanFieldTests.test_null_default 
>>> > raw_query.tests.RawQueryTests.test_pyformat_params 
>>>
>>>
>> In addition of the above issue, it seems that pyformat isn't supported 
>> for Python3. Something around these lines:
>> cursor.execute("INSERT INTO table f1, f2 values(%(val1)s, %(val2)s)", 
>> {"val1": value_1, "val2": value_2})
>>
>> I've created issues on the mysqlclient bug tracker.
>> https://github.com/PyMySQL/mysqlclient-python/issues/3
>> https://github.com/PyMySQL/mysqlclient-python/issues/4
>>
>> Claude
>>
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/35badf29-051c-44af-9938-607ed2a7d1ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [RFC] Python 3 and MySQL

2014-09-09 Thread Naoki INADA
I can't run django test.

Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
Failed to install index for admin_views.PrePopulatedPostLargeSlug 
model: (1071, 'Specified key was too long; max key length is 767 bytes')

I use 1.7 tag on git repository.


On Tuesday, September 9, 2014 3:29:45 PM UTC+9, Naoki INADA wrote:
>
> I've fixed `%(xxx)s` style formatting.
>
> I have not changed error switch:
> https://github.com/PyMySQL/mysqlclient-python/blob/master/_mysql.c#L150
> https://github.com/farcepest/MySQLdb1/blob/master/_mysql.c#L180
>
> I'll investigate the problem, but I can't promise any date for fixing it.
>
>
> On Tuesday, September 9, 2014 12:35:26 AM UTC+9, Claude Paroz wrote:
>>
>> On Monday, September 8, 2014 5:19:56 PM UTC+2, Naoki INADA wrote:
>>>
>>> On Mon, Sep 8, 2014 at 11:28 PM, Tim Graham <timog...@gmail.com> wrote: 
>>> > We'd need mysqlclient to support Python 3.2 (or drop official support 
>>> for 
>>> > MySQL/Python 3.2): 
>>>
>>> Python 3.3 introduces PEP 393 (Flexible String Representation) and 
>>> many Unicode API has 
>>> been changed and deprecated.  It also introduce unicode literal. 
>>> Supporting Python 3.2 will make code messy. 
>>>
>>> I want to drop Python 3.2 support since I believe most Python 3 users 
>>> are aggressive enough 
>>> to go forward. 
>>>
>>> How Python 3.2 important for you? 
>>>
>>
>> I think we could live with MySQL not supporting Python 3.2. 
>>
>> > Python 2.7 test failures: 
>>> > 
>>> > 
>>> > custom_pk.tests.CustomPKTests.test_required_pk 
>>> > fixtures.tests.FixtureLoadingTests.test_loaddata_error_message 
>>> > 
>>> generic_relations_regress.tests.GenericRelationTests.test_target_model_is_unsaved
>>>  
>>>
>>> > get_or_create.tests.GetOrCreateTests.test_get_or_create_invalid_params 
>>> > get_or_create.tests.UpdateOrCreateTests.test_integrity 
>>> > model_fields.tests.BooleanFieldTests.test_null_default 
>>>
>>
>> Thanks Tim for testing. These errors seem to all have the same origin, 
>> null inserts into not-null columns generate OperationalError instead of 
>> IntegrityError.
>>  
>>
>>> > Python 3.4 test failures: 
>>> > 
>>> > 
>>> > backends.tests.BackendTestCase.test_cursor_execute_with_pyformat 
>>> > backends.tests.BackendTestCase.test_cursor_executemany_with_pyformat 
>>> > 
>>> backends.tests.BackendTestCase.test_cursor_executemany_with_pyformat_iterator
>>>  
>>>
>>> > custom_pk.tests.CustomPKTests.test_required_pk 
>>> > fixtures.tests.FixtureLoadingTests.test_loaddata_error_message 
>>> > 
>>> generic_relations_regress.tests.GenericRelationTests.test_target_model_is_unsaved
>>>  
>>>
>>> > get_or_create.tests.GetOrCreateTests.test_get_or_create_invalid_params 
>>> > get_or_create.tests.UpdateOrCreateTests.test_integrity 
>>> > model_fields.tests.BooleanFieldTests.test_null_default 
>>> > raw_query.tests.RawQueryTests.test_pyformat_params 
>>>
>>>
>> In addition of the above issue, it seems that pyformat isn't supported 
>> for Python3. Something around these lines:
>> cursor.execute("INSERT INTO table f1, f2 values(%(val1)s, %(val2)s)", 
>> {"val1": value_1, "val2": value_2})
>>
>> I've created issues on the mysqlclient bug tracker.
>> https://github.com/PyMySQL/mysqlclient-python/issues/3
>> https://github.com/PyMySQL/mysqlclient-python/issues/4
>>
>> Claude
>>
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c160599a-13b2-445d-a0a0-6e9cea4be953%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [RFC] Python 3 and MySQL

2014-09-09 Thread Naoki INADA
I've fixed `%(xxx)s` style formatting.

I have not changed error switch:
https://github.com/PyMySQL/mysqlclient-python/blob/master/_mysql.c#L150
https://github.com/farcepest/MySQLdb1/blob/master/_mysql.c#L180

I'll investigate the problem, but I can't promise any date for fixing it.


On Tuesday, September 9, 2014 12:35:26 AM UTC+9, Claude Paroz wrote:
>
> On Monday, September 8, 2014 5:19:56 PM UTC+2, Naoki INADA wrote:
>>
>> On Mon, Sep 8, 2014 at 11:28 PM, Tim Graham <timog...@gmail.com> wrote: 
>> > We'd need mysqlclient to support Python 3.2 (or drop official support 
>> for 
>> > MySQL/Python 3.2): 
>>
>> Python 3.3 introduces PEP 393 (Flexible String Representation) and 
>> many Unicode API has 
>> been changed and deprecated.  It also introduce unicode literal. 
>> Supporting Python 3.2 will make code messy. 
>>
>> I want to drop Python 3.2 support since I believe most Python 3 users 
>> are aggressive enough 
>> to go forward. 
>>
>> How Python 3.2 important for you? 
>>
>
> I think we could live with MySQL not supporting Python 3.2. 
>
> > Python 2.7 test failures: 
>> > 
>> > 
>> > custom_pk.tests.CustomPKTests.test_required_pk 
>> > fixtures.tests.FixtureLoadingTests.test_loaddata_error_message 
>> > 
>> generic_relations_regress.tests.GenericRelationTests.test_target_model_is_unsaved
>>  
>>
>> > get_or_create.tests.GetOrCreateTests.test_get_or_create_invalid_params 
>> > get_or_create.tests.UpdateOrCreateTests.test_integrity 
>> > model_fields.tests.BooleanFieldTests.test_null_default 
>>
>
> Thanks Tim for testing. These errors seem to all have the same origin, 
> null inserts into not-null columns generate OperationalError instead of 
> IntegrityError.
>  
>
>> > Python 3.4 test failures: 
>> > 
>> > 
>> > backends.tests.BackendTestCase.test_cursor_execute_with_pyformat 
>> > backends.tests.BackendTestCase.test_cursor_executemany_with_pyformat 
>> > 
>> backends.tests.BackendTestCase.test_cursor_executemany_with_pyformat_iterator
>>  
>>
>> > custom_pk.tests.CustomPKTests.test_required_pk 
>> > fixtures.tests.FixtureLoadingTests.test_loaddata_error_message 
>> > 
>> generic_relations_regress.tests.GenericRelationTests.test_target_model_is_unsaved
>>  
>>
>> > get_or_create.tests.GetOrCreateTests.test_get_or_create_invalid_params 
>> > get_or_create.tests.UpdateOrCreateTests.test_integrity 
>> > model_fields.tests.BooleanFieldTests.test_null_default 
>> > raw_query.tests.RawQueryTests.test_pyformat_params 
>>
>>
> In addition of the above issue, it seems that pyformat isn't supported for 
> Python3. Something around these lines:
> cursor.execute("INSERT INTO table f1, f2 values(%(val1)s, %(val2)s)", 
> {"val1": value_1, "val2": value_2})
>
> I've created issues on the mysqlclient bug tracker.
> https://github.com/PyMySQL/mysqlclient-python/issues/3
> https://github.com/PyMySQL/mysqlclient-python/issues/4
>
> Claude
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/3f29471a-c174-4985-8018-881f866edaa0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [RFC] Python 3 and MySQL

2014-09-08 Thread Naoki INADA

On Monday, September 8, 2014 2:04:26 PM UTC+9, Naoki INADA wrote:
>
> > 
> > Naoki, 
> > 
> > Are you aware of performance benchmarks comparing your MySQLdb1 fork and 
> > mysql-connector-python? 
>
> I'll show you some numbers.  But I'm not have time for now. 
>

I've posted quick benchmark:
https://github.com/methane/mysql-driver-benchmarks

Most heavy part of MySQL Driver is parsing packet.
There are (number of columsn) descripter packet and (number of columns * 
number of rows) result packet in query response.

On PyPy, packet parsing is faster after JIT warmup.
MySQL-Connector/Python reads from socket packet by packed.  It makes many 
system call.
PyMySQL uses buffering for faster receiving.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/86510ef0-f470-47c6-a137-44caf6e87373%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [RFC] Python 3 and MySQL

2014-08-14 Thread Naoki INADA

On Wednesday, August 13, 2014 1:41:22 AM UTC+9, Tim Graham wrote:
>
> I'd like see some community consensus on the best solution for a MySQL 
> adapter rather than than have more than one build for MySQL.
>
> I don't know the MySQL ecosystem very well. Naoki, is there no interest 
> from MySQLdb in your Python 3 compatibility changes? On the PyPI page it 
> says, 
> "Python-3.0 will be supported in a future release." but it's been like that 
> for several years so who knows if it's actually going to happen.
>

I've sent pull request to MySQLdb that support Python 3. 
(https://github.com/farcepest/MySQLdb1/pull/62 )
But project owner (Andy) doesn't have time to review PRs for now.

MySQLdb is the most popular MySQL driver for long years. But it's Andy's 
personal project and development speed is
slowed down for these years. (https://github.com/farcepest )

I hope Andy make MySQLdb as community based project.
But I have not proposed it to him, because I'm afraid my poor English say 
something rude.

So I've released my fork (including windows wheel) as mysqlclient.
I'll maintain it until Andy will be back active.


PyMySQL is also popular MySQL driver because it's pure Python and works 
well with gevent.
PyMySQL was also inactive for few years. But it switched to new maintainer 
(Marcel).
https://groups.google.com/forum/#!topic/pymysql-users/hrIYyeGMQwY

After switching, I'm also active committer of PyMySQL.
We've released PyMySQL 0.6 as stable release supporting Python 3.


MySQL-Connector/Python was not so popular (as far as I know).
But 1.2.2 GA was released recently.  It looks nice to me. It may be popular 
if Django recommend it.
It's repository was moved from launchpad to 
github. https://github.com/oracle/mysql-connector-python

Although it looks nice to me, there are 2 drawbacks.

* They don't put package to PyPI. `--allow-external mysql-connector-python` 
option is required for `pip install`.
* Although repository was moved to Github, bug database is still bit 
unfriendly (http://bugs.mysql.com/ ).


I think if Oracle will be more familiar with OSS community (accepting pull 
requests, using Travis-CI, etc...),
It can replace PyMySQL. Because it's development is more active than us.
 

>
> I think we could at least consider a change from the (somewhat random?) 
> Python 3 fork of MySQLdb we are using for the Python 3 bulids.
>
> On Friday, June 6, 2014 12:44:12 PM UTC-4, Collin Anderson wrote:
>>
>> While we're on the topic, I'd like to propose (also?) supporting the 
>> pure-python, MySQLdb-compatible pymysql, which INADA Naoki (methane) has 
>> also put a lot of work into. 
>>
>> pymysql is pure-python, so it's really easy to get up-and running on Mac 
>> OS X and in other environments, because you don't need the mysql header 
>> files around. Just pip install pymysql, and you're good to go.
>>
>> https://code.djangoproject.com/ticket/22391
>>
>> Tim says on the ticket: "One question I have is how we are going to 
>> ensure that it doesn't break if we merge it to core. Do we need another 
>> MySQL build to the Jenkins matrix?"
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/aa5e3c01-9aab-449c-b1c8-defde73065dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[RFC] Python 3 and MySQL

2014-06-03 Thread Naoki INADA
Hi, folks.

I believe most popular MySQL driver for Python is MySQL-python (MySQLdb).
http://py3readiness.org/ shows MySQL-python is the 4th popular package that 
does not support Python 3.

I've forked MySQL-python because I want to move Python 3 completely ASAP.

https://pypi.python.org/pypi/mysqlclient
https://github.com/PyMySQL/mysqlclient-python


https://docs.djangoproject.com/en/dev/ref/databases/#mysql-db-api-drivers
references MySQL-for-Python3 as Python 3 port but it doesn't support binary 
and
it has not maintained for a long time.

So I propose replacing MySQL-for-Python3 with my fork.


MySQL-Connector/Python 1.2.2 (GA) has been released recently (not updated 
PyPI, but you
can download it from http://dev.mysql.com/downloads/connector/python/ ). It 
also support
Python 3 and Django.
One option for moving to Python 3 is recommend MySQL Connector/Python and 
doesn't
support MySQL-python nor mysqlclient.

https://code.djangoproject.com/ticket/12500
https://code.djangoproject.com/ticket/22732

But parsing MySQL packets with pure CPython is slow. Quick benchmark shows
MySQL Connector/Python is 5x slower than mysqlclient.

https://gist.github.com/methane/90ec97dda7fa9c7c4ef1

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e4c85c41-1a4b-42e5-8673-39e19bbc6d79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.