allensdk.internal.api package

Module contents

exception allensdk.internal.api.OneOrMoreResultExpectedError[source]

Bases: RuntimeError

class allensdk.internal.api.PostgresQueryMixin(*, dbname, user, host, password, port)[source]

Bases: object

fetchall(self, query, strict=True)[source]
fetchone(self, query, strict=True)[source]
select(self, query)[source]
select_one(self, query)[source]
allensdk.internal.api.db_connection_creator(credentials: Union[allensdk.core.authentication.DbCredentials, NoneType] = None, fallback_credentials: Union[dict, NoneType] = None) → allensdk.internal.api.PostgresQueryMixin[source]

Create a db connection using credentials. If credentials are not provided then use fallback credentials (which attempt to read from shell environment variables).

Note: Must provide one of either ‘credentials’ or ‘fallback_credentials’. If both are provided, ‘credentials’ will take precedence.

credentials : Optional[DbCredentials], optional

User specified credentials, by default None

fallback_credentials : dict

Fallback credentials to use for creating the DB connection in the case that no ‘credentials’ are provided, by default None.

Fallback credentials will attempt to get db connection info from shell environment variables.

Some examples of environment variables that fallback credentials will try to read from can be found in allensdk.core.auth_config.


A DB connection instance which can execute queries to the DB specified by credentials or fallback_credentials.


If neither ‘credentials’ nor ‘fallback_credentials’ were provided.

allensdk.internal.api.psycopg2_select(query, database, host, port, username, password)[source]