Re: Getting at Oracle ROWID

2012-06-13 Thread Ian
On Wednesday, June 13, 2012 5:48:07 AM UTC-6, rahajiyev wrote: > > DatabaseError at / > > ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP > BY, etc. > > > Unfortunately Django doesn't show the precise statement that caused the > error. > The query it generates is:

Re: Getting at Oracle ROWID

2012-06-13 Thread rahajiyev
Thanks, here's what I came up with: In the model: class RowidField(models.CharField): def __init__(self, *args, **kwargs): kwargs['name'] = 'rowid' kwargs['max_length'] = 18 kwargs['primary_key'] = True super(RowidField,

Re: Getting at Oracle ROWID

2012-06-12 Thread Ian
On Thursday, June 7, 2012 11:22:56 PM UTC-6, rahajiyev wrote: > > > > MyModel.objects.extra(select={'rowid': "rowid || ''"}) > > > Thanks. I don't think extra() takes primary_key=True, does it? > I wouldn't want Django to auto-add column id otherwise. > > Assuming I have: >

Re: Getting at Oracle ROWID

2012-06-07 Thread rahajiyev
> MyModel.objects.extra(select={'rowid': "rowid || ''"}) > Thanks. I don't think extra() takes primary_key=True, does it? I wouldn't want Django to auto-add column id otherwise. Assuming I have: MyModel.objects.extra(select={'id': "rowid || ''"}) OK, that's fine for fetching the ID itself,

Re: Getting at Oracle ROWID

2012-06-07 Thread Ian
On Thursday, June 7, 2012 3:55:37 AM UTC-6, rahajiyev wrote: > > There's an existing Oracle database I want to hook Django up with. The > problem is, the table I need lacks single-key primary keys. Oracle > does provide its unique table-wide ROWID which can normally be used as > a PK with a few

Getting at Oracle ROWID

2012-06-07 Thread rahajiyev
There's an existing Oracle database I want to hook Django up with. The problem is, the table I need lacks single-key primary keys. Oracle does provide its unique table-wide ROWID which can normally be used as a PK with a few restrictions. But it's a LOB, so a cast to string is normally required to