Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
npe
Oct 15, 2004
Need some django help... I posted this to the django users group but I have a bad feeling it's not going to get any hits, so I may as well see if anyone has any ideas. Anyways:

I've been trying to get django working with a legacy system which I feel could benefit greatly from it, however I've managed to hit a critical snag. Our setup is such that we have tables in multiple schemas, so (for example) there might be one called "app_sys" and another called "app_prod", with tables in each that need to be accessed.

Initially I had been working with 0.96 and managed to get things working by specifying db_table values in class Meta with the schema prefix... for example

code:
class Documents(models.Model):
    documentid = models.IntegerField(primary_key=True, db_column='documentid')
    # ...etc

    class Meta:
        db_table = 'app_prod.documents'
However, I ended up upgrading to the SVN release (to try and see if slicing query results worked, they don't seem to with Oracle in .96) and now I see that table names are quoted. This means my trick doesn't work anymore, because what gets put into the query is

code:
SELECT "APP_PROD.DOCUMENTS"."DOCUMENTID", <snip>
   FROM "APP_PROD.DOCUMENTS" ...etc
Of course with the quotes, Oracle is looking in the user's schema for a table named with the period, which doesn't exist. Naturally, what I was doing was pretty hackish, so I'm not bothered that this particular approach doesn't work (it seemed pretty sketchy anyways), but on the other hand if I can't figure out how to specify the full schema and table name in SOME way, it seems to kill this effort completely.

Does anyone have any ideas for a way around this?

npe fucked around with this message at 18:43 on Dec 6, 2007

Adbot
ADBOT LOVES YOU

npe
Oct 15, 2004
You're on to me! I actually tried that right after posting about this, and it seems to be working for now, which is letting me continue development in the meantime. But I'm highly embarassed about it... hopefully there's a real solution at some point in the future. :(

npe
Oct 15, 2004
Edit: I assume when you say "never learned how to do it manually" you were wondering how to do that, but maybe I misread. Well, here's how to do it manually I guess...

Simple way is to just add the values of the columns set to 1. Like:

code:
 8 4 2 1
---------
 0 0 0 0 = 0
 0 0 0 1 = 1
 0 0 1 0 = 2
 0 0 1 1 = 2 + 1 = 3
 ...
 0 1 0 1 = 4 + 1 = 5
 0 1 1 0 = 4 + 2 = 6
 0 1 1 1 = 4 + 2 + 1 = 7
 ...
 1 1 1 1 = 8 + 4 + 2 + 1 = 15

For 8 bits, same deal, but

code:
 128 64 32 16  8  4  2  1
--------------------------
   1  1  1  1  1  1  1  1 = 255

npe fucked around with this message at 03:15 on Apr 3, 2008

  • Locked thread