Skip to content

Adding auto create to pub/sub topic.#949

Closed
dhermes wants to merge 1 commit intogoogleapis:masterfrom
dhermes:fix-905
Closed

Adding auto create to pub/sub topic.#949
dhermes wants to merge 1 commit intogoogleapis:masterfrom
dhermes:fix-905

Conversation

@dhermes
Copy link
Copy Markdown
Contributor

@dhermes dhermes commented Jun 25, 2015

Fixes #905.


This is labelled don't merge because it doesn't adhere to the truly optimal case described in #905 by @jonparrott. I sent the PR just to have more discussion here (now that @tseaver is back in the US).

I'm worried that implementing the method used by node will be painful. I suppose we could do it with something like a custom class that is just bound to the topic and calls made for it

class CustomHttp(object):

    def __init__(self, http, object_to_create):
        self._http = http
        self._object_to_create = object_to_create
        self._creation_checked = False

    def request(self, method, uri=None, headers=None, body=None):
        # Just do the request
        try:
            self._http(method, uri=uri, headers=headers, body=body)
        except:
            # Do some other stuff

BUT, no matter how I slice it, the added complexity doesn't seem to be worth it for a measly feature like auto_create. But maybe I am undervaluing it?

@dhermes dhermes added do not merge Indicates a pull request not ready for merge, due to either quality or timing. api: pubsub Issues related to the Pub/Sub API. labels Jun 25, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 25, 2015
@dhermes dhermes added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jun 25, 2015
@dhermes
Copy link
Copy Markdown
Contributor Author

dhermes commented Jun 25, 2015

It looks like I also needed to delete the reviewninja webhook (see #948 for original reviewninja post) from the GitHub settings. Lets hope it stops bothering us 😄

@theacodes
Copy link
Copy Markdown
Contributor

To be honest, in python looking before you leap isn't as overly onerous as it is in node:

if not topic.exists():
    topic.create()

So I'm okay with nixing this if the cost/benefit isn't good. My only issue now is that the check for exists is slow, but that's not this library's fault.

@dhermes
Copy link
Copy Markdown
Contributor Author

dhermes commented Jun 30, 2015

@jonparrott Sorry for the huge delay in reply.

Since it was @waprin who filed, I want to feel out for how he feels about closing #905.

Also I noticed on googleapis/google-cloud-node#696 that you and @tmatsuo are having some reservations of autoCreate and/or think that exists() is a fine substitute for autoCreate.

@waprin
Copy link
Copy Markdown
Contributor

waprin commented Jun 30, 2015

Yeah in retrospect auto_create creates more confusion than convenience, I'm fine with just closing them all down.

@dhermes dhermes closed this Jun 30, 2015
@dhermes
Copy link
Copy Markdown
Contributor Author

dhermes commented Jun 30, 2015

Thanks guys! Let me know if there is anything we can do to make the sample writing process easier.

@dhermes dhermes deleted the fix-905 branch June 30, 2015 19:11
parthea pushed a commit that referenced this pull request Nov 24, 2025
…tion (#949)

* add partitioning and clustering to the to_gbq function

* feat: add partitioning and clustering to the to_gbq function

* added tests

* fixed documentation error

* run nox -r -s format lint

---------

Co-authored-by: Tim Sweña (Swast) <swast@google.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
* chore(python): Add Python 3.12

* feat: Add Python 3.12

* Allow extra log message in cache tests.
parthea pushed a commit that referenced this pull request Nov 26, 2025
🤖 I have created a release *beep* *boop*
---


## [2.4.0](googleapis/google-auth-library-python@v2.3.3...v2.4.0) (2022-01-20)


### Features

* add 'py.typed' declaration ([#919](googleapis/google-auth-library-python#919)) ([c993504](googleapis/google-auth-library-python@c993504))
* add api key support ([#826](googleapis/google-auth-library-python#826)) ([3b15092](googleapis/google-auth-library-python@3b15092))


### Bug Fixes

* **deps:** allow cachetools 5.0 for python 3.7+ ([#937](googleapis/google-auth-library-python#937)) ([1eae37d](googleapis/google-auth-library-python@1eae37d))
* fix the message format for metadata server exception ([#916](googleapis/google-auth-library-python#916)) ([e756f08](googleapis/google-auth-library-python@e756f08))


### Documentation

* fix intersphinx link for 'requests-oauthlib' ([#921](googleapis/google-auth-library-python#921)) ([967be4f](googleapis/google-auth-library-python@967be4f))
* note ValueError in `verify_oauth2_token` ([#928](googleapis/google-auth-library-python#928)) ([82bc5f0](googleapis/google-auth-library-python@82bc5f0))

---
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 pull request Mar 2, 2026
Format string issue

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-pubsub/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
parthea pushed a commit that referenced this pull request Mar 9, 2026
* samples: add preconditions to objects.delete

* add preconditons to rewrite category samples

* add compose and update previous changes

* preconditions to rewrites and encrypted uploads

* add preconditions to objects insert

* refine optional block wording and flow

* update test
parthea pushed a commit that referenced this pull request Mar 9, 2026
Co-authored-by: Astha Mohta <35952883+asthamohta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants