Example #1
0
def _get_bigquery_client():
    try:
        client = bigquery.Client()
    except DefaultCredentialsError as e:
        raise FeastProviderLoginError(
            str(e) +
            '\nIt may be necessary to run "gcloud auth application-default login" if you would like to use your '
            "local Google Cloud account")
    except EnvironmentError as e:
        raise FeastProviderLoginError(
            "GCP error: " + str(e) +
            "\nIt may be necessary to set a default GCP project by running "
            '"gcloud config set project your-project"')

    return client
Example #2
0
 def _initialize_client(self):
     try:
         return datastore.Client(project=self._gcp_project_id,
                                 namespace=self._namespace)
     except DefaultCredentialsError as e:
         raise FeastProviderLoginError(
             str(e) +
             '\nIt may be necessary to run "gcloud auth application-default login" if you would like to use your '
             "local Google Cloud account ")
Example #3
0
def _initialize_client(
    project_id: Optional[str], namespace: Optional[str]
) -> datastore.Client:
    try:
        client = datastore.Client(project=project_id, namespace=namespace,)
        return client
    except DefaultCredentialsError as e:
        raise FeastProviderLoginError(
            str(e)
            + '\nIt may be necessary to run "gcloud auth application-default login" if you would like to use your '
            "local Google Cloud account "
        )
Example #4
0
    def _initialize_client(self):
        from google.cloud import datastore

        try:
            if self._gcp_project_id is not None:
                return datastore.Client(self._gcp_project_id)
            else:
                return datastore.Client()
        except DefaultCredentialsError as e:
            raise FeastProviderLoginError(
                str(e) +
                '\nIt may be necessary to run "gcloud auth application-default login" if you would like to use your local Google Cloud account'
            )
Example #5
0
    def _get_client(self, online_config: DatastoreOnlineStoreConfig):

        if not self._client:
            try:
                self._client = datastore.Client(
                    project=online_config.project_id,
                    namespace=online_config.namespace,
                )
            except DefaultCredentialsError as e:
                raise FeastProviderLoginError(
                    str(e) +
                    '\nIt may be necessary to run "gcloud auth application-default login" if you would like to use your '
                    "local Google Cloud account ")
        return self._client