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

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

Closed
ryanseys opened this issue May 12, 2015 · 11 comments
Closed

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

ryanseys opened this issue May 12, 2015 · 11 comments
Assignees
Labels
api: datastore Issues related to the Datastore API. type: question Request for information or clarification. Not an issue.

Comments

@ryanseys
Copy link
Contributor

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?

@ryanseys ryanseys added api: datastore Issues related to the Datastore API. type: question Request for information or clarification. Not an issue. labels May 12, 2015
@stephenplusplus
Copy link
Contributor

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.

@jgeewax
Copy link
Contributor

jgeewax commented May 12, 2015

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?

@jgeewax jgeewax added this to the Datastore Future milestone May 12, 2015
@ryanseys
Copy link
Contributor Author

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.

@jgeewax
Copy link
Contributor

jgeewax commented May 12, 2015

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?

@ryanseys
Copy link
Contributor Author

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.

@jgeewax
Copy link
Contributor

jgeewax commented May 12, 2015

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

@ryanseys
Copy link
Contributor Author

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

@stephenplusplus
Copy link
Contributor

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.

@stephenplusplus
Copy link
Contributor

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

@callmehiphop
Copy link
Contributor

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

@stephenplusplus
Copy link
Contributor

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.

sofisl pushed a commit that referenced this issue Nov 10, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
🤖 I have created a release *beep* *boop*
---


## [4.0.1](googleapis/nodejs-dataproc@v4.0.0...v4.0.1) (2022-06-20)


### Bug Fixes

* **deps:** update dependency @google-cloud/storage to v6 ([#592](googleapis/nodejs-dataproc#592)) ([54ffbec](googleapis/nodejs-dataproc@54ffbec))
* fixes for dynamic routing and streaming descriptors ([#591](googleapis/nodejs-dataproc#591)) ([3d1dc28](googleapis/nodejs-dataproc@3d1dc28))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
sofisl pushed a commit that referenced this issue Nov 11, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/null-loader</summary>

### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#&#8203;400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15)

[Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0)

##### Bug Fixes

-   support `webpack@5`

##### ⚠ BREAKING CHANGES

-   minimum required Nodejs version is `10.13`

</details>

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-dialogflow).
sofisl pushed a commit that referenced this issue Jan 24, 2023
sofisl pushed a commit that referenced this issue Jan 25, 2023
sofisl pushed a commit that referenced this issue Sep 13, 2023
* chore: cleanup unused protos in google/cloud/automl/v1

PiperOrigin-RevId: 429068183

Source-Link: googleapis/googleapis@ed90e7c

Source-Link: googleapis/googleapis-gen@0070e3e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA3MGUzZTIxYzEwMjI1Mjk1MWYzYmI4YjcyNzI3NDVhNTdiYjA2ZSJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants