maxtepkeev / architect

A set of tools which enhances ORMs written in Python with more features
Other
391 stars 57 forks source link

AttributeError: 'NoneType' object has no attribute 'column' #41

Closed alexei closed 7 years ago

alexei commented 7 years ago

This is what I'm getting when trying to install the partition feature on an existing model Source:

@architect.install('partition', type='range', subtype='date',
                   constraint='month', column='day')

Result:

Traceback (most recent call last):
  File "/Users/alexei/.virtualenvs/myproject/bin/architect", line 11, in <module>
    sys.exit(main())
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/architect/commands/__init__.py", line 93, in main
    commands[command]['parser'].result(args.func(vars(args)))
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/architect/commands/partition.py", line 32, in run
    cls.architect.partition.get_partition().prepare()
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/architect/orms/bases.py", line 91, in get_partition
    database = get_database(self.model_meta['dialect'])
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/architect/orms/django/features.py", line 89, in model_meta
    'pk': meta.pk.column,
AttributeError: 'NoneType' object has no attribute 'column'
alexei commented 7 years ago

Never mind. I didn't pay attention and was trying to install the feature on an abstract model.