google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

Spanner docs are outdated

Open vkedia opened this issue 9 years ago • 11 comments

Spanner docs still talk about checking out a session and then doing operations on that such as session.snapshot and session.batch. We changed the API long time back where such operations can be done directly on the database object and that is the API we want to promote. Please audit all the docs to scrub out all the calls directly made on session object and replace those with calls on Database object. This should be doe before Beta since we expect an uptick in usage once we mark the client as Beta and we want to people to use the preferred API.

vkedia avatar Aug 07 '17 16:08 vkedia

cc @lukesneeringer @bjwatson @danoscarmike

vkedia avatar Aug 07 '17 16:08 vkedia

Also the snapshot doc should talk about nuances of using Snapshots with multi use and single use and the fact that users need to call begin if they need to have multiple pending operations.

vkedia avatar Aug 07 '17 16:08 vkedia

I presume we will drop discussion of sessions from the narrative / usage docs, but leave the API docs pages in place (since users might still come across them, e.g. in tracebacks).

tseaver avatar Aug 09 '17 21:08 tseaver

Yeah I agree leaving the API docs pages in place is OK. We can probably emphasise on those API docs that most users need not interact with these objects directly.

vkedia avatar Aug 09 '17 21:08 vkedia

cc @lukesneeringer @danoscarmike I don;t think this has been completely resolved. For eg the transactions doc still talks about using a session and does not mention database.run_in_transaction method: https://googlecloudplatform.github.io/google-cloud-python/stable/spanner/transaction-usage.html

Ditto for snapshots page: https://googlecloudplatform.github.io/google-cloud-python/stable/spanner/snapshot-usage.html

Can we please reopen this bug? I would also like this to be fixed before marking the client library as GA.

vkedia avatar Nov 17 '17 00:11 vkedia

I'm trying to write tests for spanner and I'm also having problems trying to use it from reading the documentation.

chemelnucfin avatar Nov 17 '17 01:11 chemelnucfin

@chemelnucfin Can you reopen this? I do not have permissions.

vkedia avatar Nov 17 '17 21:11 vkedia

@vkedia so just to make sure, all these methods currently on the session object should be directly done on the database object? Is the session object still needed then? Any other methods which should be directly on the database?

def snapshot(self, **kw):
def read(self, table, columns, keyset, index='', limit=0):
def execute_sql(self, sql, params=None, param_types=None, query_mode=None):
def batch(self):
def transaction(self):
def run_in_transaction(self, func, *args, **kw):

chemelnucfin avatar Dec 01 '17 17:12 chemelnucfin

Users should never have to use session object for anything. If possible we should make it non public. Also we removed the read and execute_sql methods from database. So users need to create a snapshot to do that.

vkedia avatar Dec 01 '17 17:12 vkedia

@chemelnucfin Is there a PR corresponding to this issue? (Other than the last couple of tests, I think it is the last GA blocking item.)

lukesneeringer avatar Dec 18 '17 15:12 lukesneeringer

Closed via #4610, #4611, #4409, #4630

chemelnucfin avatar Dec 20 '17 19:12 chemelnucfin