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

Add support for namespaces #1

Closed
jgeewax opened this issue Jan 29, 2014 · 3 comments
Closed

Add support for namespaces #1

jgeewax opened this issue Jan 29, 2014 · 3 comments
Assignees
Labels
api: datastore Issues related to the Datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@jgeewax
Copy link
Contributor

jgeewax commented Jan 29, 2014

These exist to an extent but aren't universal and certainly not well documented.

There are two options:

  1. Create an object to manage namespaces
from gcloud import datastore
dataset = datastore.get_dataset(...)
namespace = dataset.namespace('my-namespace')
person = namespace.entity('Person')
person['name'] = 'JJ'
person.save()

query = namespace.query('Person')
print query.fetch()
  1. Allow users to pass a namespace argument to various constructors (and set namespaces with a method, akin to setting a kind or id on a Key).
from gcloud import datastore
dataset = datastore.get_dataset(...)
person = dataset.entity('Person')
person.namespace('my-namespace')
person['name'] = 'JJ'
person.save()

query = dataset.query('Person').namespace('my-namespace')
print query.fetch()

or

person = namespace.entity('Person')
person['name'] = 'JJ'
person.save(namespace='my-namespace')

I currently prefer option 2, where a namespace isn't a separate level in the hierarchy, but simply a flag passed around on queries or entities.

@proppy
Copy link
Contributor

proppy commented Jan 29, 2014

I think in 2) examples you meant person = dataset.entity('Person') not person = namespace.entity('Person')

@jgeewax
Copy link
Contributor Author

jgeewax commented Jan 29, 2014

Updated.

@tseaver
Copy link
Contributor

tseaver commented Oct 17, 2014

I believe we address all the cases in the protobuf spec:

Please re-open if we've missed a case.

@tseaver tseaver closed this as completed Oct 17, 2014
@jgeewax jgeewax modified the milestone: Datastore Stable Jan 30, 2015
urshala pushed a commit to urshala/google-cloud-python that referenced this issue Jan 17, 2020
urshala pushed a commit to urshala/google-cloud-python that referenced this issue Jan 17, 2020
urshala pushed a commit to urshala/google-cloud-python that referenced this issue Jan 17, 2020
merge janscas latest changes
parthea pushed a commit that referenced this issue Sep 22, 2023
parthea pushed a commit that referenced this issue Sep 22, 2023
parthea pushed a commit that referenced this issue Sep 22, 2023
* chore: add split repo templates

* Loosen coverage threshold to 89%
parthea pushed a commit that referenced this issue Sep 22, 2023
parthea added a commit that referenced this issue Sep 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
* updated CHANGELOG.md [ci skip]

* updated setup.cfg [ci skip]

* updated setup.py

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
parthea pushed a commit that referenced this issue Oct 21, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## 0.1.0 (2021-04-05)


### Features

* generate v1 ([1a14a9c](https://www.github.com/googleapis/python-appengine-admin/commit/1a14a9c4dba69fae84586b59da27762b5f39e58b))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 21, 2023
* chore: add split repo templates

* test: don't install test_utils

* test: add test utils
parthea pushed a commit that referenced this issue Oct 21, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## 0.1.0 (2021-10-01)


### Features

* generate google.cloud.common ([61b5082](https://www.github.com/googleapis/python-cloud-common/commit/61b5082fcb5a48cc1006e01102f35ec9730e0f14))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Oct 21, 2023
parthea pushed a commit that referenced this issue Oct 21, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## 0.1.0 (2021-06-25)


### Features

* generate v1beta3 ([ce2226e](https://www.github.com/googleapis/python-dataflow/commit/ce2226ea43a77009a710093caef4075650377989))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 21, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## 0.1.0 (2021-10-02)


### Features

* generate v1 ([c95b948](https://www.github.com/googleapis/python-filestore/commit/c95b948e2ef5ed12dacf1b830013a1e5c51147ce))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 21, 2023
parthea pushed a commit that referenced this issue Oct 21, 2023
parthea pushed a commit that referenced this issue Oct 21, 2023
* chore: add split repo templates

* fix: test change to make ci green

* fix: add test_utils

* fix: adjust import path

* fix: jk reverting path I got wrong

* fix: test utils

* fix: more test_utils

* fix: update symlink

* fix: add bu sun suggestions

* fix: re add sphinx doctest
parthea pushed a commit that referenced this issue Oct 21, 2023
* chore: add split repo templates

* fix: loosen coverage paths

* fix: storage from pypi

* fix: add test_utils

* fix: install test_utils

* fix: lower coverage percentage

* fix: changelog redirect

* fix: changelog redirect
parthea pushed a commit that referenced this issue Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
parthea pushed a commit that referenced this issue Oct 21, 2023
* chore: add split repo templates

* chore: blacken noxfile
parthea pushed a commit that referenced this issue Oct 22, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## 0.1.0 (2021-03-15)


### Features

* generate v1beta1 ([655d649](https://www.github.com/googleapis/python-gke-hub/commit/655d64963fcdc7a3102b1b025ba967eab26a3ff3))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 22, 2023
parthea pushed a commit that referenced this issue Oct 22, 2023
parthea pushed a commit that referenced this issue Oct 22, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## 0.1.0 (2021-03-24)


### Features

* generate v1 ([1088a47](https://www.github.com/googleapis/python-service-management/commit/1088a4726aa3e5bd8b04e37db2a9e99329d1e5a5))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 22, 2023
* chore: add split repo templates

* fix: remove core and api-core from local

* fix: add test_utils

* fix: adjust coverage stats
parthea pushed a commit that referenced this issue Oct 31, 2023
parthea added a commit that referenced this issue Sep 4, 2024
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: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants