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: 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