GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Why is datastore initialized differently than the other libraries? · Issue #593 · googleapis/google-cloud-node

Why is datastore initialized differently than the other libraries? #593

New issue
Copy link
New issue
Copy link
Closed
Closed
Why is datastore initialized differently than the other libraries?#593
Copy link
Assignees
stephenplusplus
Labels
api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.
Milestone
Datastore Future

Description

@ryanseys
ryanseys
opened on May 12, 2015
Issue body actions

See here for what I'm talking about. Seems that once gcloud is initialized, datastore cannot be initialized with different options. I think this is because we delegated it to the dataset object instead but that just is kinda messy. Would it be worth it to change this to be consistent with the other APIs?

Current way:

var gcloud = require('gcloud')(options);
var datastore = gcloud.datastore;
var dataset = datastore.dataset(newOptions);

Proposed way:

var gcloud = require('gcloud')(options);
var datastore = gcloud.datastore(newOptions);
var dataset = datastore.dataset();

ADDITIONAL CRAZY IDEA: What if we just eliminated the dataset altogether? Something like:

var gcloud = require('gcloud')(options);
var datastore = gcloud.datastore(newOptions);
var key = datastore.key('Company');
datastore.save(key, { data: { hello: 'world' } }, callback);

Anything preventing us from doing this?

Activity

Next
  1. ryanseys
    added
    api: datastoreIssues related to the Datastore API.
    type: questionRequest for information or clarification. Not an issue.
    on May 12, 2015
  2. stephenplusplus commented on May 12, 2015

    @stephenplusplus
    stephenplusplus
    on May 12, 2015
    Contributor
    More actions

    I would really like to do the last one. @rakyll said to anticipate more things added to Datastore, which was why we couldn't do it.

  3. jgeewax commented on May 12, 2015

    @jgeewax
    jgeewax
    on May 12, 2015
    Contributor
    More actions

    I'm down for:

    var gcloud = require('gcloud')(options);
    var datastore = gcloud.datastore(newOptions);
    var dataset = datastore.dataset('name of the dataset' /* optional */);
    var key = datastore.key('Company');
    datastore.save(key, { data: { hello: 'world' } }, callback);

    The reason we can't kill data set is that we are in the process of adding the ability to have multiple datasets (we'll probably call them databases) per project, so datastore.save() is a misleading concept...

    But I still think we need to allow you to configure stuff at the datastore level... ? right?

  4. jgeewax
    added this to the Datastore Future milestone on May 12, 2015
  5. ryanseys commented on May 12, 2015

    @ryanseys
    ryanseys
    on May 12, 2015
    ContributorAuthor
    More actions

    Oh, as far as I understand right now we have no concept of a name of a dataset, right? In that case I like my first new proposal where it will just take no options for the time being until this multi-dataset functionality rolls around. This would be a breaking change.

  6. jgeewax commented on May 12, 2015

    @jgeewax
    jgeewax
    on May 12, 2015
    Contributor
    More actions

    datastore.dataset() should always still work, and default to the ID of the project. In the future, we need a way of passing in a name of a dataset (datastore.dataset('name')).

    Don't think this should be a breaking change, right?

  7. ryanseys commented on May 12, 2015

    @ryanseys
    ryanseys
    on May 12, 2015
    ContributorAuthor
    More actions

    It would be breaking because gcloud.datastore will now be a function that needs to be called with options. datastore.dataset will no longer accept these options. And it doesn't make sense to have it in both places.

  8. jgeewax commented on May 12, 2015

    @jgeewax
    jgeewax
    on May 12, 2015
    Contributor
    More actions

    Gotcha - we couldn't make it work with and without the parens? (gcloud.datastore == gcloud.datastore()) ?

  9. ryanseys commented on May 12, 2015

    @ryanseys
    ryanseys
    on May 12, 2015
    ContributorAuthor
    More actions

    Maybe but if we're in the business of breaking things with the moving of options from dataset to datastore then we should just break it. Also this is much easier to do pre-1.0

  10. stephenplusplus commented on Jun 30, 2015

    @stephenplusplus
    stephenplusplus
    on Jun 30, 2015
    Contributor
    More actions

    Just want to make sure this is correct:

    // uses dataset-id-1:
    var gcloud = require('gcloud')({ projectId: 'dataset-id-1' });
    gcloud.datastore.dataset();
    
    // uses dataset-id-2:
    var gcloud = require('gcloud')({ projectId: 'dataset-id-1' });
    var datastore = gcloud.datastore({ projectId: 'dataset-id-2' });
    datastore.dataset();
    
    // uses dataset-id-3:
    var gcloud = require('gcloud')({ projectId: 'dataset-id-1' });
    var datastore = gcloud.datastore({ projectId: 'dataset-id-2' });
    datastore.dataset('dataset-id-3'); // the projectId given above is useless.
  11. stephenplusplus
    self-assigned this
    on Jun 30, 2015
  12. stephenplusplus commented on Sep 4, 2015

    @stephenplusplus
    stephenplusplus
    on Sep 4, 2015
    Contributor
    More actions

    @callmehiphop does this change how you would approach your PR (#845) at all?

  13. callmehiphop commented on Sep 4, 2015

    @callmehiphop
    callmehiphop
    on Sep 4, 2015
    Contributor
    More actions

    I don't believe so, I think it would simplify the api object creation though.

  14. stephenplusplus commented on Nov 25, 2015

    @stephenplusplus
    stephenplusplus
    on Nov 25, 2015
    Contributor
    More actions

    This is going to be not-a-thing when datastore v1beta3 is released (see #897). The dataset concept is gone and there is only a "datastore" per project.

  15. 16 remaining items

  16. sofisl
    added a commit that references this issue on Feb 3, 2026

    chore: release 4.6.0 (#593)

    38c64a0
  17. GautamSharda
    added a commit that references this issue on Feb 3, 2026

    chore: new owl bot post processor docker image (#593)

    943a4f6
  18. sofisl
    added a commit that references this issue on Feb 5, 2026

    chore: release 5.0.6 (#593)

    76f98a5
  19. GautamSharda
    added 2 commits that reference this issue on Feb 5, 2026

    fix(build): migrate to using main branch (#593)

    2c7dd15

    chore: release 2.0.3 (#594)

    3c2cbcc
  20. sofisl
    added a commit that references this issue on Feb 17, 2026

    chore: release 5.0.6 (#593)

    1241dba
  21. GautamSharda
    added 6 commits that reference this issue on Feb 23, 2026

    fix(build): migrate to using main branch (#593)

    b5a5c2e

    chore: release 2.0.3 (#594)

    110d966

    chore: revert previous node-version template updates (#593)

    26c187b

    Revert "chore: revert previous node-version template updates (#593)" (#…

    aaf8776

    fix(build): migrate to using main branch (#593)

    b6429ac

    chore: release 2.0.3 (#594)

    48b7363
  22. sofisl
    added a commit that references this issue on Feb 26, 2026

    fix(deps): update dependency @google-cloud/paginator to v1 (#593)

    7918e88
  23. GautamSharda
    added 2 commits that reference this issue on Mar 11, 2026

    build: update build config and doc comments (#593)

    cd6e06b

    chore(deps): update dependency nock to v13 (#593)

    cf733f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    • Datastore FutureNo due date

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.