WIP Core client library and integration test framework.

@alainjobart @guoliang100 @sougou 
Includes -
* DatabaseContext as the primary entry point.
* Base classes that control routing and cursor creation.
* Sql builder constructs.
* Integration test framework.
* Simple end to end test for unsharded keyspace and table.
Next - 
* Examples and test for range-sharding.
* Failure/error cases.
* Examples with db operation decorators.

You can perceive this as a app-level setting with default value False. In
my mind, this is not a switch that you will toggle often hence
didn't add the mechanism for turning off.
This is supposed to govern the behavior of the library when the
app_read_only_mode is set and will change master reads to replica reads.

Do you have a concrete use-case in mind ?

On Tue, Dec 23, 2014 at 3:26 PM, Liang <notifications@github.com> wrote:

> In py/vtdb/database_context.py
> <https://github.com/youtube/vitess/pull/269#discussion-diff-22240491>:
>
> > +    """Returns the cached vtgate connection or creates a new one.
> > +
> > +    Transactions and some of the consistency guarantees rely on vtgate
> > +    connections being sticky hence this class caches the connection.
> > +    """
> > +    if self.vtgate_connection is not None and not self.vtgate_connection.is_closed():
> > +      return self.vtgate_connection
> > +
> > +    #TODO: the connect method needs to be extended to include query n txn timeouts as well
> > +    #FIXME: what is the best way of passing other params ?
> > +    connect_method = get_vtgate_connect_method()
> > +    self.vtgate_connection = connect_method(self.vtgate_addrs, self.connection_timeout)
> > +    return self.vtgate_connection
> > +
> > +  def degrade_master_read_to_replica(self):
> > +    self.change_master_read_to_replica = True
>
> There is no way to turn this flag off. Do we allow upgrading back to read
> from master?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/youtube/vitess/pull/269/files#r22240491>.
>