Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to initialize architect using Django #2

Closed
faxioman opened this issue Aug 6, 2014 · 11 comments
Closed

Unable to initialize architect using Django #2

faxioman opened this issue Aug 6, 2014 · 11 comments
Assignees
Labels

Comments

@faxioman
Copy link

faxioman commented Aug 6, 2014

Hi.
I'm not able to initialize architect using Django
I'm trying using:

architect partition --module mdata.models

where mdata is my app and models the module with my partitioned model.
I'm using virtualenv and my current path is where "mdata" exists.

@faxioman
Copy link
Author

faxioman commented Aug 6, 2014

Anyway, setting the PYTHONPATH to my current folder, works.

@maxtepkeev maxtepkeev self-assigned this Aug 7, 2014
@maxtepkeev
Copy link
Owner

Hi!

If I understood you correctly, architect was unable to find your models and you managed to get it working after modifying PYTHONPATH, right ?

@faxioman
Copy link
Author

faxioman commented Aug 7, 2014

Yes, correct.

@nickspring
Copy link

same problem

@budlight
Copy link

budlight commented Sep 3, 2014

I had this same problem, also might need a documentation warning for django users that you can't use foreign keys like

user = models.ForeignKey(
        'account.Account', blank=True, null=True,
        on_delete=models.SET_NULL)

instead use:

from account.models import Account
user = models.ForeignKey(
        Account, blank=True, null=True,
        on_delete=models.SET_NULL)

@maxtepkeev
Copy link
Owner

Initializing problem with Django will be fixed in the next version, thank you all guys for reporting this.

@budlight
Working with foreign keys currently is not implemented in the way it should be. This is a work in progress and will be released as soon as it is finished. There are also a lot more stuff to do to make the library fully compatible and correctly working with all the database features. I'm considering to create a FAQ, TODO and so on, to make it more transparent and understandable for other users and contributors to understand what's going on and what needs to be implemented.

Anyway I highly appreciate any reports about all the problems you have or any other suggestions.

@budlight
Copy link

budlight commented Sep 4, 2014

I don't have your test suite setup not sure all the ins and outs of it but something like
add in

from django.db import transaction

then

    def test_range_atomic(self):
        with transaction.atomic():
            object1 = RangeDateYear.objects.create(name='foo', created=datetime.datetime(2014, 4, 15, 18, 44, 23))
        object2 = RangeDateYear.objects.raw('SELECT * FROM test_rangedateyear_y2014 WHERE id = %s', [object1.id])[0]

        self.assertTrue(object1.name, object2.name)

should trigger an exception, not the best test, but like I said haven't tried out your test suite

@maxtepkeev maxtepkeev added bug and removed question labels Oct 28, 2014
maxtepkeev added a commit that referenced this issue Nov 23, 2014
@gotlium
Copy link

gotlium commented Dec 5, 2014

ALTER TABLE dbmail_maillog PARTITION BY RANGE (TO_DAYS(created))(
            PARTITION dbmail_maillog_y2014m12 VALUES LESS THAN (0)
);

MSG: Cannot delete or update a parent row: a foreign key constraint fails

MySQL does not support foreign keys on partitioned tables.

Foreign keys not supported for partitioned InnoDB tables. Partitioned tables using the InnoDB storage engine do not support foreign keys. More specifically, this means that the following two statements are true:

  1. No definition of an InnoDB table employing user-defined partitioning may contain foreign key references; no InnoDB table whose definition contains foreign key references may be partitioned.
  2. No InnoDB table definition may contain a foreign key reference to a user-partitioned table; no InnoDB table with user-defined partitioning may contain columns referenced by foreign keys.

@pajooh
Copy link

pajooh commented Mar 10, 2015

@maxtepkeev could you tag a new version (0.2.1?) containing the fix of this bug please?
where using pip, it's better to tag frequently to keep everyone up to date

@maxtepkeev
Copy link
Owner

@pajooh Yeah, I know. The problem is that there are several other important bugs that should be fixed before the next release will be possible. I didn't have a time for this project until now, now I'm in the process of rewriting some parts of it and fixing the bugs, so expect a new release in the next few weeks.

@maxtepkeev
Copy link
Owner

Fixed in v0.3.0. Please see docs, because Architect was almost completely rewritten.

@gotlium I didn't completely get what your comment was about. If it is still relevant, please open a new issue with detailed description of the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants