Re: Call for use cases of metrics in django core

2012-10-31 Thread Alex Gaynor
On Wed, Oct 31, 2012 at 9:52 PM, Eric Holscher wrote: > A couple obvious places: > > Latency to backend systems. So, any time that I call out to my cache > backend or database, keep track of round trip latency of those. > > Full system latency. So, From the time a request enters the URL routing >

Re: Call for use cases of metrics in django core

2012-10-31 Thread Andy McKay
We use django-statsd in conjunction with statsd and rely upon inserting monkey patches into the stack. Having some hooks in Django that can be used to monitor that stuff would be really useful. Currently we've got patches for redis, sql queries, cache queries, template parsing and rendering along

Re: Call for use cases of metrics in django core

2012-10-31 Thread Eric Holscher
A couple obvious places: Latency to backend systems. So, any time that I call out to my cache backend or database, keep track of round trip latency of those. Full system latency. So, From the time a request enters the URL routing until it gets sent back to a client. Request counts. Keep track

Call for use cases of metrics in django core

2012-10-31 Thread Jeremy Dunck
If you use/monitor/graph metrics (the idea, not Coda's library, but that would be good, too), I'd like to hear from you. What sort of metrics, under what implementation, would be useful to you operationally? -- You received this message because you are subscribed to the Google Groups "Django de

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Ian Kelly
On Wed, Oct 31, 2012 at 2:57 PM, Łukasz Rekucki wrote: > Why all the slashes ? Unless you specify r'' or make them double, they > don't do anything! > Because the OP had them, and for visual clarity, since it can be hard to distinguish whether '" is an a single quote followed by a double quote o

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Łukasz Rekucki
On 31 October 2012 21:46, Ian Kelly wrote: > On Wed, Oct 31, 2012 at 2:18 PM, Michał Nowotka wrote: >> >> But what is really buggy here is if i explicitly specify that this >> table is not managed django should respect db_table and not perform >> any truncation. That's all. > > > It won't truncat

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Ian Kelly
On Wed, Oct 31, 2012 at 2:18 PM, Michał Nowotka wrote: > But what is really buggy here is if i explicitly specify that this > table is not managed django should respect db_table and not perform > any truncation. That's all. > It won't truncate the name if you fully enclose it in quotes. Instead

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Michał Nowotka
I think you mixed many things here. First of all db_table = 'schema_name\".\"table_name' is a well known hack to make django support Oracle multiple schemas. So this is not a bug, but it would be nice if we have better solution. As the consequence of this hack django treats the hole db_table stri

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Ian Kelly
On Wed, Oct 31, 2012 at 12:34 PM, Michał Nowotka wrote: > Another thing - this name is not truncated - some junk is appended and not > after 30 characters but earlier and only for some table names regardless of > length. > The truncation actually truncates to 26 characters and then appends the f

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Ian Kelly
On Wed, Oct 31, 2012 at 1:23 PM, Shai Berger wrote: > I'm not sure -- perhaps the db_tablespace option is interpreted by the > Oracle > backend as schema, which would allow what Michal is trying to do with a > sane > API. Otherwise, I'd advise Michal to look at Oracle's table aliases, and > mark

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Ian Kelly
On Wed, Oct 31, 2012 at 1:23 PM, Shai Berger wrote: > This, almost worthy of being called an sql injection, can't be the right way > to achieve the goal. In fact, the Oracle backend (or even some higher, more > generic level) should have doubled those '"' characters to make them part of > the name

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Anssi Kääriäinen
On 31 loka, 21:23, Shai Berger wrote: > Hi Michal and Django devs, > > While for the most part, Jacob is correct in marking this as a usage question, > there does appear to be something buggy here. > > Note how Michal is abusing the db_table setting to select a name with a > schema. He's looking f

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Łukasz Rekucki
On 31 October 2012 20:23, Shai Berger wrote: > This, almost worthy of being called an sql injection, can't be the right way > to achieve the goal. In fact, the Oracle backend (or even some higher, more > generic level) should have doubled those '"' characters to make them part of > the name. But -

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Shai Berger
Hi Michal and Django devs, While for the most part, Jacob is correct in marking this as a usage question, there does appear to be something buggy here. Note how Michal is abusing the db_table setting to select a name with a schema. He's looking for "protein_therapeutics" (<30) in "mnowotka": >

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Łukasz Rekucki
On 31 October 2012 19:31, Michał Nowotka wrote: > I would understand truncating but please take a look: > > class DefinedDailyDose(models.Model): > #... > class Meta: > db_table = u'mnowotka\".\"defined_daily_dose' > managed=False > > where the name is even longer Don't want t

Re: Class based views: A standard hook for http-method-independent code (and a proposal for an init() method)

2012-10-31 Thread Jordan Hagan
Diedreik, Thanks for your comments - your solution seems similar to the one proposed by Meshy unless I'm missing something (https://gist.github.com/1957251). It is good to see multiple people coming up with the same solution to the issue independently though as that to me is an indication that

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Jacob Kaplan-Moss
Please, read the documentation closely; this is indeed intended behavior: """ Oracle imposes a name length limit of 30 characters. To accommodate this, the backend truncates database identifiers to fit, replacing the final four characters of the truncated name with a repeatable MD5 hash value. """

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Michał Nowotka
Another thing - this name is not truncated - some junk is appended and not after 30 characters but earlier and only for some table names regardless of length. I suppose this is a bug in django oracle backend and that's why I'm writing it here. -- You received this message because you are subs

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Michał Nowotka
I would understand truncating but please take a look: class DefinedDailyDose(models.Model): #... class Meta: db_table = u'mnowotka\".\"defined_daily_dose' managed=False where the name is even longer DefinedDailyDose.objects.exists() gives: SELECT * FROM (SELECT ROWNUM AS

Re: Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Jacob Kaplan-Moss
Hi Michal - See https://docs.djangoproject.com/en/dev/ref/databases/#naming-issues -- Oracle has a limit on the length of table names, so Django has to truncate some table names. In the future, can you please direct questions like this to django-users? Django-developers is for discussion of devel

Django produce sql with table name different then specified in meta db_table

2012-10-31 Thread Michał Nowotka
Hello, I'm using django 1.4 with oracle backend In my models.py I have: class ProteinTherapeutics(models.Model): #... class Meta: db_table = 'mnowotka\".\"protein_therapeutics' managed=False And this: ProteinTherapeutics.objects.exists() produces this SQL: SELECT * FROM

Re: Class based views: A standard hook for http-method-independent code (and a proposal for an init() method)

2012-10-31 Thread Meshy
Marc and I have been using a mixin to override `dispatch()` with this functionality. He has an ongoing pull request on django-braceswith the code. I hope this can be useful to some of you. Meshy. On Wednesday, October 31, 2012 9:49:26 AM UTC, Di

Re: Class based views: A standard hook for http-method-independent code (and a proposal for an init() method)

2012-10-31 Thread Diederik van der Boor
Hi, Please allow me to add my €0.02. In a large project I've experienced a similar issue; and we solved it in a slightly different way. What we also noticed was: - overriding dispatch(), get() or post() wasn't good enough anymore. - the views need some initialization moment before their workflow