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

Update minimum version of psycopg2 required #45

Merged
merged 1 commit into from
Sep 14, 2017
Merged

Conversation

karenc
Copy link
Owner

@karenc karenc commented Sep 14, 2017

For the super_user context manager, we are doing something like:

db_conn = psycopg2.connect('user=tester dbname=testing', user='postgres')

This was not supported by psycopg2 < 2.7:

Traceback (most recent call last):
  File \"/var/cnx/venvs/publishing/bin/dbmigrator\", line 11, in <module>
    sys.exit(main())
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/cli.py\", line 104, in main
    return args['cmmd'](**args)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 145, in wrapper
    return func(cursor, *args, **kwargs)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/commands/migrate.py\", line 32, in cli_command
    run_deferred)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 227, in compare_schema
    callback(*args, **kwargs)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 257, in run_migration
    migration.up(cursor)
  File \"../../var/cnx/venvs/publishing/src/cnx-db/cnxdb/migrations/20170912134157_shred-colxml-uuids.py\", line 19, in up
    with super_user() as super_cursor:
  File \"/usr/lib/python2.7/contextlib.py\", line 17, in __enter__
    return self.gen.next()
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 57, in super_user
    user=super_user) as db_conn:
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/psycopg2/__init__.py\", line 155, in connect
    % items[0][0])
TypeError: 'user' is an invalid keyword argument when the dsn is specified

For the `super_user` context manager, we are doing something like:

```
db_conn = psycopg2.connect('user=tester dbname=testing', user='postgres')
```

This was not supported by psycopg2 < 2.7:

```
Traceback (most recent call last):
  File \"/var/cnx/venvs/publishing/bin/dbmigrator\", line 11, in <module>
    sys.exit(main())
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/cli.py\", line 104, in main
    return args['cmmd'](**args)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 145, in wrapper
    return func(cursor, *args, **kwargs)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/commands/migrate.py\", line 32, in cli_command
    run_deferred)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 227, in compare_schema
    callback(*args, **kwargs)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 257, in run_migration
    migration.up(cursor)
  File \"../../var/cnx/venvs/publishing/src/cnx-db/cnxdb/migrations/20170912134157_shred-colxml-uuids.py\", line 19, in up
    with super_user() as super_cursor:
  File \"/usr/lib/python2.7/contextlib.py\", line 17, in __enter__
    return self.gen.next()
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 57, in super_user
    user=super_user) as db_conn:
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/psycopg2/__init__.py\", line 155, in connect
    % items[0][0])
TypeError: 'user' is an invalid keyword argument when the dsn is specified
```
@karenc karenc merged commit fe79247 into master Sep 14, 2017
@karenc karenc deleted the update-psycopg2 branch September 14, 2017 21:11
@reedstrm
Copy link
Contributor

looks good

@coveralls
Copy link

coveralls commented Sep 14, 2017

Coverage Status

Coverage remained the same at 97.118% when pulling 52458cb on update-psycopg2 into c8a4c96 on master.

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

Successfully merging this pull request may close these issues.

None yet

3 participants