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

documentation of postgres setup and switch from yaml to ini #40

Open
mtholder opened this issue Nov 18, 2016 · 4 comments
Open

documentation of postgres setup and switch from yaml to ini #40

mtholder opened this issue Nov 18, 2016 · 4 comments

Comments

@mtholder
Copy link
Member

I think that I have it working now, but I'm not very good with postgres so it took me a while to figure out how to sync the get the sqlalchemy string in the INI files to work with the authentication settings that my postgres pg_hba.conf files.
Also I think the README in the otindex/scripts dir may not be up to date wrt the changes from yaml to INI formats.

@kcranston
Copy link
Member

You are correct that scripts/README is not up to date. Sorry about that! I've been making a lot of changes to get the ansible stuff working. Will take a look at all the docs.

Interested to hear more about the postgres issues.

@mtholder
Copy link
Member Author

I'm not sure it has to do with my pg_hba.conf I think that I just created the db with a password. When I try to adapt the development-example I get the stacktrace below if I use:

sqlalchemy.url = postgresql://usernamehere@localhost/dbnamehere

Even though my password is in the connection_info part of the ini.
I have to use:

sqlalchemy.url = postgresql://usernamehere:passwordhere@localhost/dbnamehere

to get it to work.

Traceback (most recent call last):
  File "./env/bin/initialize_otindex_db", line 11, in <module>
    load_entry_point('otindex', 'console_scripts', 'initialize_otindex_db')()
  File "/home/mtholder/Documents/projects/ot/otindex/otindex/scripts/initializedb.py", line 39, in main
    Base.metadata.create_all(engine)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3748, in create_all
    tables=tables)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1855, in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1848, in _optional_conn_ctx_manager
    with self.contextual_connect() as conn:
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2039, in contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2078, in _wrap_pool_connect
    e, dialect, self)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1405, in _handle_dbapi_exception_noconnection
    exc_info
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2074, in _wrap_pool_connect
    return fn()
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 376, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 713, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 480, in checkout
    rec = pool._do_get()
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 1060, in _do_get
    self._dec_overflow()
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 1057, in _do_get
    return self._create_connection()
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 323, in _create_connection
    return _ConnectionRecord(self)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 449, in __init__
    self.connection = self.__connect()
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/pool.py", line 607, in __connect
    connection = self.__pool._invoke_creator(self)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 97, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 385, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/home/mtholder/Documents/projects/ot/otindex/env/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) fe_sendauth: no password supplied

@kcranston
Copy link
Member

You are correct about the string needing the password. I'll update the example INI files. Thanks!

@kcranston
Copy link
Member

This commit should address the documentation deficiencies.

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

2 participants