Package csb :: Package io :: Module tsv :: Class RepositoryImp

[frames] | no frames]

# Class RepositoryImp

source code

    object --+
             |
            RepositoryImp

Known Subclasses:
  - SQLiteRepository

Abstract SQL backend interface. Defines a number of platform-specific operations, that each concrete backend implementor must provide.

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods

__init__(self, tablename) x.__init__(...) initializes x; see help(type(x)) for signature | source code

close(self) Perform cleanup (e.g. | source code

int

count(self) Count the number of rows in the table. | source code

create(self, metadata) Create a table given `metadata`. | source code

execute(self, expression) Perform a select operation given `expression`. | source code

insert(self, row) Insert a new tuple in the table. | source code

query(self, sql, params=None) Execute a native SQL query against the backend, as-is. | source code

update(self, expression) Perform an update operation given `expression`. | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| __abstractmethods__ = ``frozenset([``'``close``'``,` `'``count``'``,` `'``create``'``,` `'``...``

Properties
| pk
str | table Table name
Inherited from `object`: `__class__`

Method Details

### __init__(self, tablename)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### close(self)

source code

Perform cleanup (e.g. close connections).

### create(self, metadata)

source code

Create a table given `metadata`.

Parameters:
  - `metadata` (tuple of ColumnInfo)
Returns:
  void

### execute(self, expression)

source code

Perform a select operation given `expression`.

Parameters:
  - `expression` (Expression)
Returns:
  data reader (2D iterable)

### insert(self, row)

source code

Insert a new tuple in the table.

Parameters:
  - `row` (tuple)
Returns:
  void

### query(self, sql, params=None)

source code

Execute a native SQL query against the backend, as-is.

Parameters:
  - `sql` (str) - SQL query
  - `params` (tuple) - query bound parameters, if any
Returns:
  data reader (2D iterable)

### update(self, expression)

source code

Perform an update operation given `expression`.

Parameters:
  - `expression` (Expression)
Returns:
  void

Class Variable Details

### __abstractmethods__

Value:

      frozenset(['close',
                 'count',
                 'create',
                 'execute',
                 'insert',
                 'pk',
                 'update'])

Property Details

### pk

Get Method:
  unreachable.pk(self)

### table

Table name

Get Method:
  unreachable.table(self) - Table name
Type:
  str