Thursday, May 29, 2014

Re: Using AWS Redshift database Django 1.6

Ah, I see!  I was mistaken, then.  So the base db backend's sql_create_model is what generates the create table with the constraint?  Then a db backend subclass just needs to override that to do whatever dbms-specific stuff it wants?  Is there documentation on what all the methods in a django.db.backends module are supposed to do?  (The docstrings in the code seem decent enough, just wondering if there's anything more detailed than that.)

Thanks!
jpk


On Thu, May 29, 2014 at 1:48 PM, C. Kirby <misthop@gmail.com> wrote:
I'll answer what I can from a quick review of the codebase.


On Thursday, May 29, 2014 12:36:39 PM UTC-5, jpk wrote:
Yeah, I came across that as well, but it didn't work on 1.6.  I cloned and debugged it up until I got the exact same error as the paste in my first message. :(

So, a few questions:
  • Am I correct in my analysis that the syncdb command alone is generating the table creation sql that includes the constraint redshift is barfing on?
No, syncdb (or in 1.7+ migrate) eventually calls the correct db backend to generate the sql. You can see from the code that there is no SQL there, just calls to the backend sql generation (In particular look at line 96)
  • If I were to patch the syncdb command code, is it reasonable to consult the database backend for settings related to which constraints are allowed/not?
I would not change the sync code. A better path would probably be to start with the postgres backend and make the changes necessary for redshift (I assume that is what the django-redshift project started to do)
  • Does it make more sense for the database backend code to do the table creation instead of syncdb?  (As in, db backends provide might an abstracted create table method that syncdb could just call instead of building its own sql.)
I know more than I did a day ago, but I'm still not super hip on how db backends are implemented and how the rest of the framework interacts with them.  So if the stuff I'm asking doesn't make sense then do put me on the right path. :)

Thanks!
jpk
 
Kirby

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5a094392-088f-4062-b85a-2a0a24bf192b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
john p. kiffmeyer

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEQ4iqVi6DWt4FqCyoGBhq%3D7KBJd-tvkRMMc5Fh_ES9-M9bTLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment