Re: MySQL Query

2012-02-08 Thread 常 剑
seems like you have no module MySQLdb in your python site-packages, 
install it and try again
在 2012-2-9,AM2:15, Bill 写道:

> Hello
> 
> I am completing the Django tutorials, however I am having a problem
> when syncing the DB to Django.  I am getting the following message.
> Any help would be appreciated.
> 
> C:\Python27\Django-131\django\bin\mysite>manage.py syncdb
> Traceback (most recent call last):
>  File "C:\Python27\Django-131\django\bin\mysite\manage.py", line 14,
> in > 
>execute_manager(settings)
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 438, in execute_manager
>utility.execute()
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 379, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 261, in fetch_command
>klass = load_command_class(app_name, subcommand)
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 67, in load_command_class
>module = import_module('%s.management.commands.%s' % (app_name,
> name))
>  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>__import__(name)
>  File "C:\Python27\lib\site-packages\django\core\management\commands
> \syncdb.py"
> , line 7, in 
>from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_
> signal
>  File "C:\Python27\lib\site-packages\django\core\management\sql.py",
> line 6, in
> 
>from django.db import models
>  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 78,
> in  e>
>connection = connections[DEFAULT_DB_ALIAS]
>  File "C:\Python27\lib\site-packages\django\db\utils.py", line 93, in
> __getitem
> __
>backend = load_backend(db['ENGINE'])
>  File "C:\Python27\lib\site-packages\django\db\utils.py", line 33, in
> load_back
> end
>return import_module('.base', backend_name)
>  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>__import__(name)
>  File "C:\Python27\lib\site-packages\django\db\backends\mysql
> \base.py", line 14
> , in 
>raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No mo
> dule named MySQLdb
> 
> Many thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL Query

2012-02-08 Thread Bill
Many thanks it is now working!!

On Feb 8, 6:21 pm, Sandro Dutra  wrote:
> Probably you've to install python-mysqldb.
>
> 2012/2/8 Bill :
>
>
>
>
>
>
>
> > Hello
>
> > I am completing the Django tutorials, however I am having a problem
> > when syncing the DB to Django.  I am getting the following message.
> > Any help would be appreciated.
>
> > C:\Python27\Django-131\django\bin\mysite>manage.py syncdb
> > Traceback (most recent call last):
> >  File "C:\Python27\Django-131\django\bin\mysite\manage.py", line 14,
> > in 
> >    execute_manager(settings)
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 438, in execute_manager
> >    utility.execute()
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 379, in execute
> >    self.fetch_command(subcommand).run_from_argv(self.argv)
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 261, in fetch_command
> >    klass = load_command_class(app_name, subcommand)
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 67, in load_command_class
> >    module = import_module('%s.management.commands.%s' % (app_name,
> > name))
> >  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> > 35, in im
> > port_module
> >    __import__(name)
> >  File "C:\Python27\lib\site-packages\django\core\management\commands
> > \syncdb.py"
> > , line 7, in 
> >    from django.core.management.sql import custom_sql_for_model,
> > emit_post_sync_
> > signal
> >  File "C:\Python27\lib\site-packages\django\core\management\sql.py",
> > line 6, in
> >  
> >    from django.db import models
> >  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 78,
> > in  > e>
> >    connection = connections[DEFAULT_DB_ALIAS]
> >  File "C:\Python27\lib\site-packages\django\db\utils.py", line 93, in
> > __getitem
> > __
> >    backend = load_backend(db['ENGINE'])
> >  File "C:\Python27\lib\site-packages\django\db\utils.py", line 33, in
> > load_back
> > end
> >    return import_module('.base', backend_name)
> >  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> > 35, in im
> > port_module
> >    __import__(name)
> >  File "C:\Python27\lib\site-packages\django\db\backends\mysql
> > \base.py", line 14
> > , in 
> >    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > module: No mo
> > dule named MySQLdb
>
> > Many thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL Query

2012-02-08 Thread Bill
Many thanks it is now working!!

On Feb 8, 6:21 pm, Anoop Thomas Mathew  wrote:
> Hi,
> Make sure that you have installed MySQL-python package for python bindings
> to mysql.
>
> Thanks,
> Anoop Thomas Mathew
>
> ___
> Life is short, Live it hard.
>
> On 8 February 2012 23:45, Bill  wrote:
>
>
>
>
>
>
>
> > Hello
>
> > I am completing the Django tutorials, however I am having a problem
> > when syncing the DB to Django.  I am getting the following message.
> > Any help would be appreciated.
>
> > C:\Python27\Django-131\django\bin\mysite>manage.py syncdb
> > Traceback (most recent call last):
> >  File "C:\Python27\Django-131\django\bin\mysite\manage.py", line 14,
> > in 
> >    execute_manager(settings)
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 438, in execute_manager
> >    utility.execute()
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 379, in execute
> >    self.fetch_command(subcommand).run_from_argv(self.argv)
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 261, in fetch_command
> >    klass = load_command_class(app_name, subcommand)
> >  File "C:\Python27\lib\site-packages\django\core\management
> > \__init__.py", line
> > 67, in load_command_class
> >    module = import_module('%s.management.commands.%s' % (app_name,
> > name))
> >  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> > 35, in im
> > port_module
> >    __import__(name)
> >  File "C:\Python27\lib\site-packages\django\core\management\commands
> > \syncdb.py"
> > , line 7, in 
> >    from django.core.management.sql import custom_sql_for_model,
> > emit_post_sync_
> > signal
> >  File "C:\Python27\lib\site-packages\django\core\management\sql.py",
> > line 6, in
> >  
> >    from django.db import models
> >  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 78,
> > in  > e>
> >    connection = connections[DEFAULT_DB_ALIAS]
> >  File "C:\Python27\lib\site-packages\django\db\utils.py", line 93, in
> > __getitem
> > __
> >    backend = load_backend(db['ENGINE'])
> >  File "C:\Python27\lib\site-packages\django\db\utils.py", line 33, in
> > load_back
> > end
> >    return import_module('.base', backend_name)
> >  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> > 35, in im
> > port_module
> >    __import__(name)
> >  File "C:\Python27\lib\site-packages\django\db\backends\mysql
> > \base.py", line 14
> > , in 
> >    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > module: No mo
> > dule named MySQLdb
>
> > Many thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL Query

2012-02-08 Thread Sandro Dutra
Probably you've to install python-mysqldb.

2012/2/8 Bill :
> Hello
>
> I am completing the Django tutorials, however I am having a problem
> when syncing the DB to Django.  I am getting the following message.
> Any help would be appreciated.
>
> C:\Python27\Django-131\django\bin\mysite>manage.py syncdb
> Traceback (most recent call last):
>  File "C:\Python27\Django-131\django\bin\mysite\manage.py", line 14,
> in >
>    execute_manager(settings)
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 438, in execute_manager
>    utility.execute()
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 379, in execute
>    self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 261, in fetch_command
>    klass = load_command_class(app_name, subcommand)
>  File "C:\Python27\lib\site-packages\django\core\management
> \__init__.py", line
> 67, in load_command_class
>    module = import_module('%s.management.commands.%s' % (app_name,
> name))
>  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>    __import__(name)
>  File "C:\Python27\lib\site-packages\django\core\management\commands
> \syncdb.py"
> , line 7, in 
>    from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_
> signal
>  File "C:\Python27\lib\site-packages\django\core\management\sql.py",
> line 6, in
>  
>    from django.db import models
>  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 78,
> in  e>
>    connection = connections[DEFAULT_DB_ALIAS]
>  File "C:\Python27\lib\site-packages\django\db\utils.py", line 93, in
> __getitem
> __
>    backend = load_backend(db['ENGINE'])
>  File "C:\Python27\lib\site-packages\django\db\utils.py", line 33, in
> load_back
> end
>    return import_module('.base', backend_name)
>  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>    __import__(name)
>  File "C:\Python27\lib\site-packages\django\db\backends\mysql
> \base.py", line 14
> , in 
>    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No mo
> dule named MySQLdb
>
> Many thanks
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL Query cache hits stay zero

2006-04-22 Thread Geert Vanderkelen

Hi Berry,

Beegee wrote:
> My test results. I installed
> mysql-standard-5.0.20-linux-x86_64-glibc23. Created a completely new
> database and restored a backup from my 'old' django database into the
> newly created MySql 5 instance.
> 
> Restarted Apache and everthing was up and running again. Great!
..

I think a 'Whooot!' would be well placed here :)

> So, it seems that the best thing to do to make use of the query cache
> of MySQL is to use MySQL 5.0.
> 
> I want to thank everybody for helping me.

Great to hear all went great! But for reference, Query Cache is working 
since MySQL 4.0. I don't know what exactly happened here, but apparently 
the restriction of InnoDB within transactions not using Query Cache was 
the culprit, which was 'solved' in MySQL 4.1.

Welcome to world of MySQL 5.0 ;)

Btw, try to use the latest Python MySQLdb module, which has was recently 
being 'upgraded' to use more MySQL 5.0 stuff.

Cheers,

Geert

-- 

Geert Vanderkelen
http://www.some-abstract-type-shit.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-22 Thread Geert Vanderkelen

Beegee wrote:
> Currently I am using MySQL version 4.0.24. Looking at all the answers
> the best thing to do is to try MySQL v5. I will do some testing over
> the weekend and post my experiences.
> 
> Thanks very much for your help.

Just FYI, binary upgrading 4.0 to 5.0 is a bad idea: dump data using 
mysqldump of MySQL 5.0, and reimport is best.

Going first 4.1 might be better, and check all ChangeLogs in the 
manual.. might be important for your stuff!

Cheers,

Geert


-- 

Geert Vanderkelen
http://www.some-abstract-type-shit.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-21 Thread Beegee

Currently I am using MySQL version 4.0.24. Looking at all the answers
the best thing to do is to try MySQL v5. I will do some testing over
the weekend and post my experiences.

Thanks very much for your help.

Berry


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-21 Thread Geert Vanderkelen

Hi Berry,

Beegee wrote:
> This is a part from the manual of MySQL: "In MySQL 4.0, the query cache
> is disabled within transactions (it does not return results). Beginning
> with MySQL 4.1.1, the query cache also works within transactions when
> using InnoDB tables (it uses the table version number to detect whether
> its contents are still current)."

For reference, this comes from:
  http://dev.mysql.com/doc/refman/4.1/en/query-cache-how.html

> So, are the following statements correct?
> 1. Apparently all Django generated or MySQLdb generated statements are
> transactional. Even ordinary select statements? Because, only
> transactional statements are not cached. (Still, it is a bit strange
> because the value of Qcache_queries_in_cache does increase over time.)

Django MySQL backend is doing a
   SET autocommit=0
when connecting, and when successful make a COMMIT.

This is regardless of used Storage Engine, working.

SELECT statements which involve InnoDB in transactions will get cached 
in MySQL 4.1 and higher. This has been noted before.

> 2. To be able to use the query cache of MySQL when using MySQL as a
> backend database for Django, you need to use at least version 4.1.1. of
> MySQL. And you need to be using InnoDB tables.

Wrong! Tim already replied, but:
Query Cache is available as of MySQL 4.0, and will also work for SELECT 
statements for InnoDB tables in transactions as of MySQL 4.1.
(Depends on storage engine, MySQL Cluster will not cache in transactions).

You never said, or I missed it, which MySQL server you are running, but 
if you are using MySQL 5.0, you will need to use following statement to 
get the real count for the complete server:
   mysql> SHOW GLOBAL STATUS LIKE 'Qcache\_%';

The GLOBAL keyword is important, as it will default to SESSION, and of 
course that stays zero as you have another session in the MySQL client.

Hope this helps!

Cheers,

Geert

-- 

Geert Vanderkelen
http://www.some-abstract-type-shit.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



RE: MySQL Query cache hits stay zero

2006-04-21 Thread Leeuw van der, Tim

Hi BeeGee,

My impression is that your first statement is correct, but not your
second:

To use the query-cache with MySQL, you either need to use MyISAM tables,
or if you use InnoDB tables and transactions, then you need to use at
least MySQL version 4.1.1
This is not related to Django.


-Original Message-
From: django-users@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Beegee
Sent: vrijdag 21 april 2006 8:19
To: Django users
Subject: Re: MySQL Query cache hits stay zero


This is a part from the manual of MySQL: "In MySQL 4.0, the query cache
is disabled within transactions (it does not return results). Beginning
with MySQL 4.1.1, the query cache also works within transactions when
using InnoDB tables (it uses the table version number to detect whether
its contents are still current)."

So, are the following statements correct?
1. Apparently all Django generated or MySQLdb generated statements are
transactional. Even ordinary select statements? Because, only
transactional statements are not cached. (Still, it is a bit strange
because the value of Qcache_queries_in_cache does increase over time.)

2. To be able to use the query cache of MySQL when using MySQL as a
backend database for Django, you need to use at least version 4.1.1. of
MySQL. And you need to be using InnoDB tables.

Berry




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-21 Thread Ned Batchelder

I don't know if this is helpful at this point, but on my MySQL 5 server, 
the query cache hit count is quite high for Django queries.

--Ned.

Beegee wrote:
> This is a part from the manual of MySQL: "In MySQL 4.0, the query cache
> is disabled within transactions (it does not return results). Beginning
> with MySQL 4.1.1, the query cache also works within transactions when
> using InnoDB tables (it uses the table version number to detect whether
> its contents are still current)."
>
> So, are the following statements correct?
> 1. Apparently all Django generated or MySQLdb generated statements are
> transactional. Even ordinary select statements? Because, only
> transactional statements are not cached. (Still, it is a bit strange
> because the value of Qcache_queries_in_cache does increase over time.)
>
> 2. To be able to use the query cache of MySQL when using MySQL as a
> backend database for Django, you need to use at least version 4.1.1. of
> MySQL. And you need to be using InnoDB tables.
>
> Berry
>
>
> >
>
>
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-21 Thread Beegee

This is a part from the manual of MySQL: "In MySQL 4.0, the query cache
is disabled within transactions (it does not return results). Beginning
with MySQL 4.1.1, the query cache also works within transactions when
using InnoDB tables (it uses the table version number to detect whether
its contents are still current)."

So, are the following statements correct?
1. Apparently all Django generated or MySQLdb generated statements are
transactional. Even ordinary select statements? Because, only
transactional statements are not cached. (Still, it is a bit strange
because the value of Qcache_queries_in_cache does increase over time.)

2. To be able to use the query cache of MySQL when using MySQL as a
backend database for Django, you need to use at least version 4.1.1. of
MySQL. And you need to be using InnoDB tables.

Berry


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-20 Thread Adrian Holovaty

On 4/20/06, Andy Dustman <[EMAIL PROTECTED]> wrote:
> Do statements generated by Django have columns in a deterministic order?

Just for the record, yes, the columns will always be in the same order.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-20 Thread Andy Dustman

On 4/20/06, Andy Dustman <[EMAIL PROTECTED]> wrote:
> I've reopened that bug, but I am very skeptical that anything in
> MySQLdb can be causing it.

And I'm probably right, since it seems he is using MySQL-4.0 which,
while it does have the query cache, it is disabled for transactions on
InnoDB. 4.1 and newer query cache supports transactions.
--
The Pythonic Principle: Python works the way it does
because if it didn't, it wouldn't be Python.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-20 Thread Andy Dustman

On 4/20/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> On 4/20/06, Beegee <[EMAIL PROTECTED]> wrote:
> > No, then it also doesn't work. When I repeat the following query:
> >
> > cursor.execute('select * from wifidog_businesses limit 10')
> >
> > using MySQLdb the number of Cache hits do not increase. However, the
> > number of Qcache_queries_in_cache also do not increase. Strange.
> >
> > I did find an issue on the MySQL for Python Sourceforge website that
> > seems to be describing the exact same issue:
>
> Ah, so it's a MySQLdb issue -- good to know. Andy Dustman, who's
> involved in maintaining MySQLdb, hangs out on the Django mailing list,
> so he might be able to shed more light on the issue.

I've reopened that bug, but I am very skeptical that anything in
MySQLdb can be causing it. All the caching logic happens on the server
side, and the only thing the client is required to do is to send the
exact (byte-for-byte) same query, and have query_cache_type (either
for SESSION or GLOBAL) set to 1, or else set query_cache_type to 2 and
use SELECT SQL_CACHE. For Django you'd want the former. Plus, updating
the tables used by the query invalidates the cache, but it doesn't
sound like you're doing that, or at least not in your example.

Do statements generated by Django have columns in a deterministic order?

--
The Pythonic Principle: Python works the way it does
because if it didn't, it wouldn't be Python.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-20 Thread Adrian Holovaty

On 4/20/06, Beegee <[EMAIL PROTECTED]> wrote:
> No, then it also doesn't work. When I repeat the following query:
>
> cursor.execute('select * from wifidog_businesses limit 10')
>
> using MySQLdb the number of Cache hits do not increase. However, the
> number of Qcache_queries_in_cache also do not increase. Strange.
>
> I did find an issue on the MySQL for Python Sourceforge website that
> seems to be describing the exact same issue:

Ah, so it's a MySQLdb issue -- good to know. Andy Dustman, who's
involved in maintaining MySQLdb, hangs out on the Django mailing list,
so he might be able to shed more light on the issue.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL Query cache hits stay zero

2006-04-20 Thread Adrian Holovaty

On 4/20/06, Beegee <[EMAIL PROTECTED]> wrote:
> When I manually type in a query on the MySQL command line and execute
> it several times, the Qcache_hits indeed increases. So, the cache
> functionality is working.

That's strange. I don't use MySQL, so I haven't encountered this
issue, but one strategy you might take to debug would be to perform
queries via the Python MySQLdb API, to see whether the lack of cache
happens at that level.

Untested example code:

>>> import MySQLdb
>>> connection = Database.connect(user='foo', db='foo', passwd='foo')
>>> cursor = connection.cursor()
>>> cursor.execute('select ...')

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---