forked from googleapis/python-spanner-django
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
docs: missing docstrings for functions & classes #13
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
  
     Closed
                    Changes from 43 commits
      Commits
    
    
            Show all changes
          
          
            60 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      11222db
              
                feat: release 2.2a0 (#457)
              
              
                larkee 5551b58
              
                feat: [WIP] The first stage of `nox` implementation (#468)
              
              
                mf2199 bfde221
              
                feat: refactor connect() function, cover it with unit tests (#462)
              
              
                 e017901
              
                feat: Stage 2 of `nox` implementation - adding `docs` target (#473)
              
              
                mf2199 144bdc2
              
                fix: Fix black, isort compatibility  (#469)
              
              
                c24t 7a1f6a6
              
                feat: Stage 3-4 of `nox` implementation - adding auto-format targets …
              
              
                mf2199 acd9209
              
                feat: Stage 5 of `nox` implementation - adding coverage targets (#479)
              
              
                mf2199 6028f88
              
                feat: cursor must detect if the parent connection is closed (#463)
              
              
                 94ba284
              
                feat: Stage 6 of `nox` implementation - enabling system tests (#480)
              
              
                mf2199 59eb432
              
                chore: Code refactoring to follow common Google API scheme - Stage I …
              
              
                mf2199 048566c
              
                chore: release 2.2a1 (#499)
              
              
                c24t f5719f8
              
                Merge branch 'master' of https://github.com/googleapis/python-spanner…
              
              
                 2c0c0a2
              
                fix: Couple of tests are permanently broken while running locally
              
              
                tina80lvl 05bf7dc
              
                fix: offset for current timezone
              
              
                tina80lvl 31185df
              
                clean: whitespace
              
              
                tina80lvl bd605a5
              
                fix: localtime->gmtime
              
              
                tina80lvl 23f87ad
              
                fix: gmtime->localtime
              
              
                tina80lvl 216a92b
              
                refactor
              
              
                tina80lvl 3b34162
              
                docs: utils.py
              
              
                tina80lvl d5ba00c
              
                docs: version.py`
              
              
                tina80lvl ccfb6ce
              
                refactor
              
              
                tina80lvl 9526cc2
              
                Merge pull request #5 from q-logic/fix-472
              
              
                mf2199 a921666
              
                Merge remote-tracking branch 'upstream/master'
              
              
                mf2199 60fd3fb
              
                docs: parser.py
              
              
                tina80lvl d86e8a1
              
                refactor
              
              
                tina80lvl 325abb9
              
                docs: parse_utils.py
              
              
                tina80lvl 539b3dd
              
                docs: cursor.py
              
              
                tina80lvl 5ce0fa9
              
                docs: connection.py
              
              
                tina80lvl a9eb4a6
              
                refactor
              
              
                tina80lvl bbb3378
              
                conflict
              
              
                tina80lvl f364372
              
                corrections
              
              
                tina80lvl a703d5c
              
                refactoring
              
              
                tina80lvl f94dc9c
              
                fixes
              
              
                tina80lvl ec1aeca
              
                conflicts
              
              
                tina80lvl 29801d9
              
                cc
              
              
                tina80lvl 28a7faa
              
                imperative
              
              
                tina80lvl 0d47d9a
              
                merge origin
              
              
                tina80lvl 717cd4e
              
                fixes
              
              
                tina80lvl 466e037
              
                conflicts
              
              
                tina80lvl 8dabb7b
              
                pull
              
              
                tina80lvl 6437b70
              
                refactor
              
              
                tina80lvl 8e26153
              
                fixes
              
              
                tina80lvl f41acd5
              
                review fixes
              
              
                tina80lvl 17eaefa
              
                cleanup
              
              
                tina80lvl a71ca06
              
                review fix
              
              
                tina80lvl a1ecbec
              
                cc
              
              
                tina80lvl b701555
              
                draft test
              
              
                tina80lvl 50570db
              
                resolving conflicts
              
              
                tina80lvl a1ad37d
              
                refactor
              
              
                tina80lvl 3c3572b
              
                revert test
              
              
                tina80lvl dc43995
              
                missing parse_values added
              
              
                tina80lvl b829809
              
                review fixes
              
              
                tina80lvl c6d924b
              
                fixed suggections
              
              
                tina80lvl 0806ab8
              
                Merge branch 'master' into docstr-1
              
              
                mf2199 9e1be73
              
                Merge branch 'master' into docstr-1
              
              
                c24t 9aa0c63
              
                Rewrap a few docstrings
              
              
                c24t 467cdaa
              
                merge
              
              
                tina80lvl c4857a4
              
                fixed conflicts
              
              
                tina80lvl e04627c
              
                merge fetch
              
              
                tina80lvl 9f286fb
              
                delete google/cloud/spanner_dbapi
              
              
                tina80lvl File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -54,8 +54,7 @@ | |
|  | ||
|  | ||
| class Cursor: | ||
| """ | ||
| Database cursor to manage the context of a fetch operation. | ||
| """Database cursor to manage the context of fetch operations. | ||
|  | ||
| :type connection: :class:`spanner_dbapi.connection.Connection` | ||
| :param connection: Parent connection object for this Cursor. | ||
|  | @@ -72,14 +71,21 @@ def __init__(self, connection): | |
| self.arraysize = 1 | ||
|  | ||
| def execute(self, sql, args=None): | ||
| """ | ||
| Abstracts and implements execute SQL statements on Cloud Spanner. | ||
| Args: | ||
| sql: A SQL statement | ||
| *args: variadic argument list | ||
| **kwargs: key worded arguments | ||
| Returns: | ||
| None | ||
| """Abstract and execute SQL statements on Cloud Spanner. | ||
|  | ||
| :type sql: str | ||
| :param sql: A SQL statement. | ||
|  | ||
| :type args: list | ||
| :param args: (Optional) a list of variadic arguments. | ||
|  | ||
| :type kwargs: list | ||
| :param kwargs: (Optional) key worded arguments. | ||
|  | ||
| :raises: :class:`IntegrityError`, if precondition failed or the argument | ||
| already exists, :class:`ProgrammingError` if there is | ||
| an invalid argument, :class:`OperationalError` if there is | ||
| an internal server error. | ||
| """ | ||
| self._raise_if_closed() | ||
|  | ||
|  | @@ -212,6 +218,19 @@ def __exit__(self, etype, value, traceback): | |
|  | ||
| @property | ||
| def description(self): | ||
| """Read-only attribute containing a sequence of the following items: | ||
|  | ||
| - ``name`` | ||
| - ``type_code`` | ||
| - ``display_size`` | ||
| - ``internal_size`` | ||
| - ``precision`` | ||
| - ``scale`` | ||
| - ``null_ok`` | ||
| # Todo review | ||
| :rtype: tuple | ||
| :returns: A tuple of columns' information. | ||
| """ | ||
| if not (self._res and self._res.metadata): | ||
| return None | ||
|  | ||
|  | @@ -232,13 +251,18 @@ def description(self): | |
|  | ||
| @property | ||
| def rowcount(self): | ||
| """Count number of rows in the table after last execution. | ||
|         
                  tina80lvl marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| :rtype: int | ||
| :returns: The number of rows that last .execute*() produced. | ||
|          | ||
| """ | ||
|         
                  tina80lvl marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| return self._row_count | ||
|  | ||
| @property | ||
| def is_closed(self): | ||
| """The cursor close indicator. | ||
|  | ||
| :rtype: :class:`bool` | ||
| :rtype: bool | ||
|         
                  IlyaFaer marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| :returns: True if this cursor or it's parent connection is closed, False | ||
| otherwise. | ||
| """ | ||
|  | @@ -265,14 +289,17 @@ def close(self): | |
|  | ||
| def executemany(self, operation, seq_of_params): | ||
| """ | ||
| Execute the given SQL with every parameters set | ||
| from the given sequence of parameters. | ||
| Execute the given SQL with every parameters set from the given sequence | ||
| of parameters. | ||
|  | ||
| :type operation: :class:`str` | ||
| :type operation: str | ||
| :param operation: SQL code to execute. | ||
|  | ||
| :type seq_of_params: :class:`list` | ||
| :type seq_of_params: list | ||
| :param seq_of_params: Sequence of params to run the query with. | ||
|  | ||
| :raises: :class:`ProgrammingError` if the cursor is not connected to | ||
| the database. | ||
| """ | ||
| self._raise_if_closed() | ||
|  | ||
|  | @@ -290,6 +317,11 @@ def __iter__(self): | |
| return self._itr | ||
|  | ||
| def fetchone(self): | ||
| # TODO review | ||
| """Fetch the next resulting row of the last ran query. | ||
|         
                  tina80lvl marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| :returns: The next element if possible, None otherwise. | ||
| """ | ||
| self._raise_if_closed() | ||
|  | ||
| try: | ||
|  | @@ -298,6 +330,13 @@ def fetchone(self): | |
| return None | ||
|  | ||
| def fetchall(self): | ||
| """ | ||
| Fetch all (remaining) rows of a query result, returning them as a | ||
| sequence of sequences (e.g. a list of tuples). | ||
|  | ||
| :rtype: list | ||
| :returns: A list of fetched rows of a query result. | ||
| """ | ||
| self._raise_if_closed() | ||
|  | ||
| return list(self.__iter__()) | ||
|  | @@ -307,13 +346,13 @@ def fetchmany(self, size=None): | |
| Fetch the next set of rows of a query result, returning a sequence of sequences. | ||
| An empty sequence is returned when no more rows are available. | ||
|  | ||
| Args: | ||
| size: optional integer to determine the maximum number of results to fetch. | ||
| :type size: int | ||
| :param size: (Optional) The maximum number of results to fetch. | ||
|  | ||
|  | ||
| Raises: | ||
| Error if the previous call to .execute*() did not produce any result set | ||
| or if no call was issued yet. | ||
| :raises InterfaceError: If the previous call to .execute*() did not | ||
| produce any result set or if no call was | ||
| issued yet. | ||
| """ | ||
| self._raise_if_closed() | ||
|  | ||
|  | @@ -343,17 +382,60 @@ def _run_prior_DDL_statements(self): | |
| return self._connection.run_prior_DDL_statements() | ||
|  | ||
| def list_tables(self): | ||
| """List the tables of the linked Database. | ||
|  | ||
| :rtype: list | ||
| :returns: The list of tables within the Database. | ||
| """ | ||
| return self._connection.list_tables() | ||
|  | ||
| def run_sql_in_snapshot(self, sql): | ||
| """Run SQL in snapshot. | ||
|  | ||
| :type sql: str | ||
| :param sql: A SQL request. | ||
|  | ||
| :rtype: list | ||
| :returns: A list of :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`. | ||
| """ | ||
| return self._connection.run_sql_in_snapshot(sql) | ||
|  | ||
| def get_table_column_schema(self, table_name): | ||
| """Get the table column schema. | ||
|  | ||
| :type table_name: str | ||
| :param table_name: The name of the table. | ||
|  | ||
| :rtype: dict | ||
| :returns: A dictionary containing the table column schema. | ||
| """ | ||
| return self._connection.get_table_column_schema(table_name) | ||
|  | ||
|  | ||
| class ColumnInfo: | ||
| """Row column description object.""" | ||
| """The object defines the column of the table in the linked Database. | ||
|  | ||
| :type name: str | ||
| :param name: The name of the column. | ||
|  | ||
| :type type_code: int | ||
| :param type_code: The code of the value type. | ||
|  | ||
| :type display_size: int | ||
| :param display_size: (Optional) A display size. | ||
|  | ||
| :type internal_size: int | ||
| :param internal_size: (Optional) An internal size. | ||
|  | ||
| :type precision: int | ||
| :param precision: (Optional) The number of significant digits. | ||
|  | ||
| :type scale: float | ||
| :param scale: (Optional) The scale. | ||
|  | ||
| :type null_ok: bool | ||
| :param null_ok: (Optional) Allows column value to be None. Default is False. | ||
| """ | ||
|  | ||
| def __init__( | ||
| self, | ||
|  | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.