This repository was archived by the owner on Oct 15, 2024. It is now read-only.
Set defaults for host, port, dbname and user later in the invocation#8
Open
waterkip wants to merge 1 commit intogmr:masterfrom
Open
Set defaults for host, port, dbname and user later in the invocation#8waterkip wants to merge 1 commit intogmr:masterfrom
waterkip wants to merge 1 commit intogmr:masterfrom
Conversation
The problem is that if one uses sqlalchemy or some other tool that uses some
kind of object that returns None for a value, eg the port you need to
reimplement a lot of the code that is in this module already.
from sqlalchemy.engine.url import make_url
uri = make_url('postgres://localhost/foo');
# yields an error that a NoneType cannot be used for int();
password = getpass(uri.host, uri.port, uri.username, uri.database);
In order to fix this a lot of the defaults need to be implemented at the caller
level.
Furthermore, the default database name is the name of the user that is supplied
to the function, eg, a user 'foo' will default to the database 'foo', as seen
in behaviour by `psql -U foo` where 'foo' isn't your username of the OS.
Signed-off-by: Wesley Schwengle <wesley@opperschaap.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem is that if one uses sqlalchemy or some other tool that uses some
kind of object that returns None for a value, eg the port you need to
reimplement a lot of the code that is in this module already.
In order to fix this a lot of the defaults need to be implemented at the caller
level.
Furthermore, the default database name is the name of the user that is supplied
to the function, eg, a user 'foo' will default to the database 'foo', as seen
in behaviour by
psql -U foowhere 'foo' isn't your username of the OS.Signed-off-by: Wesley Schwengle wesley@opperschaap.net