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

problem install with PostgreSQL database #51

Closed
repodevs opened this issue Mar 5, 2017 · 7 comments
Closed

problem install with PostgreSQL database #51

repodevs opened this issue Mar 5, 2017 · 7 comments

Comments

@repodevs
Copy link

repodevs commented Mar 5, 2017

Hello

I'm trying using PostgreSQL database to make your example work. I have problem with logs error like this

Traceback (most recent call last):
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
psycopg2.ProgrammingError: column "password" cannot be cast automatically to type bytea
HINT: You might need to specify "USING password::bytea".

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/me/.virtualenvs/flask-noota-api/bin/invoke", line 11, in
sys.exit(program.run())
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/invoke/program.py", line 293, in run
self.execute()
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/invoke/program.py", line 408, in execute
executor.execute(*self.tasks)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/invoke/executor.py", line 114, in execute
result = call.task(*args, **call.kwargs)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/invoke/tasks.py", line 114, in call
result = self.body(*args, **kwargs)
File "/home/me/CODER/python/flask-noota-api/tasks/app/_utils.py", line 61, in wrapper
return func(*args, **kwargs)
File "/home/me/CODER/python/flask-noota-api/tasks/app/db.py", line 277, in init_development_data
context.invoke_execute(context, 'app.db.upgrade')
File "/home/me/CODER/python/flask-noota-api/tasks/init.py", line 73, in invoke_execute
results = Executor(namespace, config=context.config).execute((command_name, kwargs))
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/invoke/executor.py", line 114, in execute
result = call.task(*args, **call.kwargs)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/invoke/tasks.py", line 114, in call
result = self.body(*args, **kwargs)
File "/home/me/CODER/python/flask-noota-api/tasks/app/_utils.py", line 61, in wrapper
return func(*args, **kwargs)
File "/home/me/CODER/python/flask-noota-api/tasks/app/db.py", line 163, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/command.py", line 174, in upgrade
script.run_env()
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/script/base.py", line 416, in run_env
util.load_python_file(self.dir, 'env.py')
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/util/compat.py", line 68, in load_module_py
module_id, path).load_module(module_id)
File "", line 388, in _check_name_wrapper
File "", line 809, in load_module
File "", line 668, in load_module
File "", line 268, in _load_module_shim
File "", line 693, in _load
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in call_with_frames_removed
File "migrations/env.py", line 93, in
run_migrations_online()
File "migrations/env.py", line 86, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/runtime/environment.py", line 807, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/runtime/migration.py", line 321, in run_migrations
step.migration_fn(**kw)
File "/home/me/CODER/python/flask-noota-api/migrations/versions/36954739c63
.py", line 28, in upgrade
existing_nullable=False)
File "/usr/lib/python3.5/contextlib.py", line 66, in exit
next(self.gen)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/operations/base.py", line 299, in batch_alter_table
impl.flush()
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/operations/batch.py", line 57, in flush
fn(*arg, **kw)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/ddl/postgresql.py", line 91, in alter_column
existing_nullable=existing_nullable,
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/alembic/ddl/impl.py", line 118, in _exec
return conn.execute(construct, *multiparams, **params)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 945, in execute
return meth(self, multiparams, params)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1002, in _execute_ddl
compiled
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
exc_info
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/home/me/.virtualenvs/flask-noota-api/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column "password" cannot be cast automatically to type bytea
HINT: You might need to specify "USING password::bytea".
[SQL: 'ALTER TABLE "user" ALTER COLUMN password TYPE BYTEA ']


tested with

  • Python 3.5.2
  • (PostgreSQL) 9.4.10

installed dependencies

alembic==0.8.10
aniso8601==1.2.0
apispec==0.19.0
appdirs==1.4.2
arrow==0.8.0
bcrypt==3.1.3
cffi==1.9.1
click==6.7
colorlog==2.10.0
Flask==0.12
Flask-Cors==3.0.2
Flask-Login==0.4.0
flask-marshmallow==0.7.0
Flask-OAuthlib==0.9.3
flask-restplus==0.10.1
Flask-SQLAlchemy==2.2
invoke==0.15.0
itsdangerous==0.24
Jinja2==2.9.5
jsonschema==2.6.0
lockfile==0.12.2
Mako==1.0.6
MarkupSafe==0.23
marshmallow==2.13.1
marshmallow-sqlalchemy==0.12.0
oauthlib==2.0.1
packaging==16.8
passlib==1.7.1
permission==0.4.1
psycopg2==2.7
pycparser==2.17
pyparsing==2.1.10
python-dateutil==2.6.0
python-editor==1.0.3
pytz==2016.10
PyYAML==3.12
requests==2.13.0
requests-oauthlib==0.8.0
six==1.10.0
SQLAlchemy==1.1.5
SQLAlchemy-Utils==0.32.12
webargs==1.5.3
Werkzeug==0.11.15

any idea ?

@frol
Copy link
Owner

frol commented Mar 5, 2017

Try to just comment that block altering the password column. It shouldn't be needed for Postgres. I will think of a patch...

@frol
Copy link
Owner

frol commented Mar 5, 2017

Sorry, I forgot to mention the exact place: "/home/me/CODER/python/flask-noota-api/migrations/versions/36954739c63.py", line 28

@repodevs
Copy link
Author

repodevs commented Mar 5, 2017

I have block altering the password column. it's done, but other problem come

raise exc.CompileError("PostgreSQL ENUM type requires a name.")
sqlalchemy.exc.CompileError: PostgreSQL ENUM type requires a name.

the exact place here (i think)
File "/home/me/CODER/python/flask-noota-api/migrations/versions/5e2954a2af18_refactored-auth-oauth2.py", line 69, in upgrade nullable=False

I hope you have test more with PostgreSQL 😄

@frol
Copy link
Owner

frol commented Mar 5, 2017

@repodevs I planned to drop all of the migrations once I get to the PostgreSQL support to avoid such errors in the first place :-D

I am not sure what this error means... You may try to drop all of the migrations and just regenerate the initial one. It will be the fastest way to go.

@khorolets
Copy link
Collaborator

@frol you can assign it to me, I need it as well. I can try to do it when I have some time in the nearest future.

@bberzinskas-tw
Copy link

bberzinskas-tw commented Mar 6, 2017 via email

@frol
Copy link
Owner

frol commented Mar 6, 2017

@bberzinskas-tw Could you please elaborate on what "schema name" you are talking about and where to set the search_path?

khorolets added a commit to khorolets/flask-restplus-server-example that referenced this issue Mar 7, 2017
Add PostgreSQL parameters to config (comment them by default)

Update the existed migrations to make them work with PostgreSQL.
khorolets added a commit to khorolets/flask-restplus-server-example that referenced this issue Mar 7, 2017
Add PostgreSQL parameters to config (comment them by default)

Update the existed migrations to make them work with PostgreSQL.
@frol frol closed this as completed in #52 Mar 7, 2017
frol pushed a commit that referenced this issue Mar 7, 2017
Add PostgreSQL parameters to config (comment them by default)

Update the existed migrations to make them work with PostgreSQL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants