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

How to uninstall feature? #42

Open
alexei opened this issue Sep 8, 2017 · 4 comments
Open

How to uninstall feature? #42

alexei opened this issue Sep 8, 2017 · 4 comments
Assignees
Labels

Comments

@alexei
Copy link

alexei commented Sep 8, 2017

I decorated a model with @architect.uninstall('partition') then ran architect partition --module myapp.models with the following result:

Traceback (most recent call last):
  File "~/.virtualenvs/myproject/bin/architect", line 11, in <module>
    sys.exit(main())
  File "~/.virtualenvs/myproject/lib/python2.7/site-packages/architect/commands/__init__.py", line 93, in main
    commands[command]['parser'].result(args.func(vars(args)))
  File "~/.virtualenvs/myproject/lib/python2.7/site-packages/architect/commands/partition.py", line 26, in run
    module_clss = filter(lambda obj: isinstance(obj, type), __import__(module, fromlist=module).__dict__.values())
  File "~/Projects/myproject/myapp/models/__init__.py", line 8, in <module>
    from .mymodels import *  # noqa
  File "~/Projects/myproject/myapp/models/mymodels.py", line 1048, in <module>
    class MyModel(BaseModel):
  File "~/.virtualenvs/myproject/lib/python2.7/site-packages/architect/orms/decorators.py", line 155, in __call__
    self.deinit_feature(self.feature, model)
  File "~/.virtualenvs/myproject/lib/python2.7/site-packages/architect/orms/decorators.py", line 171, in deinit_feature
    allowed=[name for name, obj in model.architect.__dict__.items() if isinstance(obj, BaseFeature)])
AttributeError: type object 'MyModel' has no attribute 'architect'

I might be doing something wrong. The docs seem a tad too brief, though :)

@maxtepkeev maxtepkeev self-assigned this Sep 12, 2017
@maxtepkeev
Copy link
Owner

maxtepkeev commented Sep 12, 2017

Yes, uninstall decorator doesn't work that way, it is used when you need to remove a feature from the model during runtime, there is an example given in the docs when this can be useful. If you want to remove created partitions on database level this should be done by hand.

@alexei
Copy link
Author

alexei commented Sep 15, 2017

Oh, I see. I wasn't expecting it to deal with partitions as that would be difficult. I was, however, expecting it to delete the triggers and stuff. Would that be impossible?

@maxtepkeev
Copy link
Owner

maxtepkeev commented Sep 18, 2017

Unfortunately no. Right now it doesn't do anything at the database level, only during runtime. So if you want to remove triggers, the only way is to that manually.

@akuisara
Copy link

akuisara commented Jul 20, 2020

Hi @maxtepkeev or @alexei how to manually remove the triggers? New records are still inserted into a partitioned table even after removing the architect package. Also, I can't seem to delete the triggers records in the information_schema table.

Please let me know if you can help, thanks!

[Update] DROP TRIGGER trigger_name ON model_table; worked for me.

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

3 participants