On Tue, Apr 26, 2016 at 1:28 PM, Duke Dougal <[email protected]> wrote:

> Hi folks,
>
>
> Model is below plus error message below that.
>
>
> I am trying to create some array columns using Alembic but getting errors.
>
>
> Any help valued.
>
>
> thanks!
>
>
>
> from sqlalchemy import Column, String, Integer, DateTime
> from serve_spec.db_global import db
> import datetime
> from time import time
> from sqlalchemy.dialects.postgresql import JSON
> from sqlalchemy.dialects.postgresql import ARRAY
>
> class Issues(db.Base):
>
>     __tablename__ = 'issues'
>
>     id = Column(String, primary_key=True)
>     thread_id                   = Column(String, nullable=False)
>     created                     = Column(DateTime(timezone=False), 
> nullable=False, default=datetime.datetime.utcnow)
>     created_timestamp           = Column(Integer, nullable=False, 
> default=time)
>     created_by_user_name        = Column(String, nullable=False)
>     is_parent                   = Column(Integer, nullable=False)
>     parent_title                = Column(String)
>     subscribed                  = Column(ARRAY(String))
>     unsubscribed                = Column(ARRAY(String))
>     pending_notifications_web   = Column(ARRAY(String))
>     pending_notifications_email = Column(ARRAY(String))
>     markdown_text               = Column(String, nullable=False, )
>     kernel_id                   = Column(String, nullable=False)
>     state                       = Column(String, nullable=False, 
> default='open')
>     labels                      = Column(JSON())
>
>
>
>
> (venv3.4.2) ubuntu@ip-172-31-8-128:/var/www/www.example.org/src/crowdwave$
> PYTHONPATH=. alembic upgrade head
> INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
> INFO  [alembic.runtime.migration] Will assume transactional DDL.
> INFO  [alembic.runtime.migration] Running upgrade d9bc97e175aa ->
> dd9e391f807f, Issues is behind
> Traceback (most recent call last):
>   File "/var/www/www.example.org/venv3.4.2/bin/alembic", line 9, in
> <module>
>     load_entry_point('alembic==0.8.5', 'console_scripts', 'alembic')()
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/config.py",
> line 479, in main
>     CommandLine(prog=prog).main(argv=argv)
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/config.py",
> line 473, in main
>     self.run_cmd(cfg, options)
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/config.py",
> line 456, in run_cmd
>     **dict((k, getattr(options, k)) for k in kwarg)
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/command.py",
> line 174, in upgrade
>     script.run_env()
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/script/base.py",
> line 397, in run_env
>     util.load_python_file(self.dir, 'env.py')
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/util/pyfiles.py",
> line 81, in load_python_file
>     module = load_module_py(module_id, path)
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/util/compat.py",
> line 68, in load_module_py
>     module_id, path).load_module(module_id)
>   File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
>   File "<frozen importlib._bootstrap>", line 1614, in load_module
>   File "<frozen importlib._bootstrap>", line 596, in _load_module_shim
>   File "<frozen importlib._bootstrap>", line 1220, in load
>   File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
>   File "<frozen importlib._bootstrap>", line 1129, in _exec
>   File "<frozen importlib._bootstrap>", line 1471, in exec_module
>   File "<frozen importlib._bootstrap>", line 321, in
> _call_with_frames_removed
>   File "alembic/env.py", line 82, in <module>
>     run_migrations_online()
>   File "alembic/env.py", line 77, in run_migrations_online
>     context.run_migrations()
>   File "<string>", line 8, in run_migrations
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/runtime/environment.py",
> line 797, in run_migrations
>     self.get_context().run_migrations(**kw)
>   File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/runtime/migration.py",
> line 312, in run_migrations
>     step.migration_fn(**kw)
>   File "/var/www/
> www.example.org/src/crowdwave/alembic/versions/dd9e391f807f_issues_is_behind.py",
> line 21, in upgrade
>     op.add_column('issues', sa.Column('pending_notifications_email',
> postgresql.ARRAY(String()), nullable=True))
> NameError: name 'String' is not defined
>

Can you show us the contents
of alembic/versions/dd9e391f807f_issues_is_behind.py ?

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to