sqlalchemy - TypeError: __init__() got an unexpected keyword argument 'nullable' when initializing database. Pyramid/Python -


getting stacktrace below when attempting init database. i'm new python/pyramid , appreciate in sorting error out.

my code:

import sqlalchemy sa ...     def foreign_key_column(name, type_, target, nullable=false):     fk = sa.foreignkey(target)     if name:         return sa.column(name, type_, fk, nullable=true)     else:         return sa.column(type_, fk, nullable=true)  class entry(base): ...        user_id = foreign_key_column(none, sa.integer, "users.id", nullable=false)     foreign_extra = sa.column(sa.unicode(100, nullable=false)) ... 

error:

traceback (most recent call last):   file "/home/username/pycharmprojects/.virtualenvs/application_env/bin/initialize_application_db", line 9, in <module>     load_entry_point('application==0.1', 'console_scripts', 'initialize_application_db')()   file "/home/username/pycharmprojects/.virtualenvs/application_env/lib/python3.4/site-packages/pkg_resources.py", line 356, in load_entry_point     return get_distribution(dist).load_entry_point(group, name)   file "/home/username/pycharmprojects/.virtualenvs/application_env/lib/python3.4/site-packages/pkg_resources.py", line 2431, in load_entry_point     return ep.load()   file "/home/username/pycharmprojects/.virtualenvs/application_env/lib/python3.4/site-packages/pkg_resources.py", line 2147, in load     ['__name__'])   file "/home/username/pycharmprojects/application/application/scripts/initializedb.py", line 20, in <module>     ..models.entry import entry   file "/home/username/pycharmprojects/application/application/models/entry.py", line 22, in <module>     class entry(base):   file "/home/username/pycharmprojects/application/application/models/entry.py", line 31, in entry     foreign_extra = sa.column(sa.unicode(100, nullable=false))   file "/home/username/pycharmprojects/.virtualenvs/application_env/lib/python3.4/site-packages/sqlalchemy/sql/sqltypes.py", line 324, in __init__     super(unicode, self).__init__(length=length, **kwargs) typeerror: __init__() got unexpected keyword argument 'nullable' 

simple typo closing parenthesis in wrong place. instead of:

sa.column(sa.unicode(100, nullable=false)) 

write:

sa.column(sa.unicode(100), nullable=false) 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -