Package gluon :: Module dal :: Class BaseAdapter
[hide private]
[frames] | no frames]

Class BaseAdapter

source code

    object --+    
             |    
ConnectionPool --+
                 |
                BaseAdapter
Known Subclasses:

Nested Classes [hide private]
  __metaclass__
Metaclass to support manipulation of adapter classes.
Instance Methods [hide private]
 
connector(*args, **kwargs) source code
 
isOperationalError(self, exception) source code
 
isProgrammingError(self, exception) source code
 
id_query(self, table) source code
 
adapt(self, obj) source code
 
smart_adapt(self, obj) source code
 
file_exists(self, filename)
to be used ONLY for files that on GAE may not be on filesystem
source code
 
file_open(self, filename, mode='rb', lock=True)
to be used ONLY for files that on GAE may not be on filesystem
source code
 
file_close(self, fileobj)
to be used ONLY for files that on GAE may not be on filesystem
source code
 
file_delete(self, filename) source code
 
find_driver(self, adapter_args, uri=None) source code
 
log(self, message, table=None)
Logs migrations
source code
 
__init__(self, db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY at 0x334cd70>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
sequence_name(self, tablename) source code
 
trigger_name(self, tablename) source code
 
varquote(self, name) source code
 
create_table(self, table, migrate=True, fake_migrate=False, polymodel=None) source code
 
migrate_table(self, table, sql_fields, sql_fields_old, sql_fields_aux, logfile, fake_migrate=False) source code
 
save_dbt(self, table, sql_fields_current) source code
 
LOWER(self, first) source code
 
UPPER(self, first) source code
 
COUNT(self, first, distinct=None) source code
 
EXTRACT(self, first, what) source code
 
EPOCH(self, first) source code
 
LENGTH(self, first) source code
 
AGGREGATE(self, first, what) source code
 
JOIN(self) source code
 
LEFT_JOIN(self) source code
 
RANDOM(self) source code
 
NOT_NULL(self, default, field_type) source code
 
COALESCE(self, first, second) source code
 
COALESCE_ZERO(self, first) source code
 
RAW(self, first) source code
 
ALLOW_NULL(self) source code
 
SUBSTRING(self, field, parameters) source code
 
PRIMARY_KEY(self, key) source code
 
_drop(self, table, mode) source code
 
drop(self, table, mode='') source code
 
_insert(self, table, fields) source code
 
_insert_empty(self, table) source code
 
insert(self, table, fields) source code
 
bulk_insert(self, table, items) source code
 
NOT(self, first) source code
 
AND(self, first, second) source code
 
OR(self, first, second) source code
 
BELONGS(self, first, second) source code
 
REGEXP(self, first, second)
regular expression operator
source code
 
LIKE(self, first, second)
case sensitive like operator
source code
 
ILIKE(self, first, second)
case in-sensitive like operator
source code
 
STARTSWITH(self, first, second) source code
 
ENDSWITH(self, first, second) source code
 
CONTAINS(self, first, second, case_sensitive=False) source code
 
EQ(self, first, second=None) source code
 
NE(self, first, second=None) source code
 
LT(self, first, second=None) source code
 
LE(self, first, second=None) source code
 
GT(self, first, second=None) source code
 
GE(self, first, second=None) source code
 
is_numerical_type(self, ftype) source code
 
REPLACE(self, first, (second, third)) source code
 
CONCAT(self, *items) source code
 
ADD(self, first, second) source code
 
SUB(self, first, second) source code
 
MUL(self, first, second) source code
 
DIV(self, first, second) source code
 
MOD(self, first, second) source code
 
AS(self, first, second) source code
 
ON(self, first, second) source code
 
INVERT(self, first) source code
 
COMMA(self, first, second) source code
 
CAST(self, first, second) source code
 
expand(self, expression, field_type=None, colnames=False) source code
 
table_alias(self, tbl) source code
 
alias(self, table, alias)
Given a table object, makes a new table object with alias name.
source code
 
_truncate(self, table, mode='') source code
 
truncate(self, table, mode=' ') source code
 
_update(self, tablename, query, fields) source code
 
update(self, tablename, query, fields) source code
 
_delete(self, tablename, query) source code
 
delete(self, tablename, query) source code
 
get_table(self, query) source code
 
expand_all(self, fields, tablenames) source code
 
_select(self, query, fields, attributes) source code
 
select_limitby(self, sql_s, sql_f, sql_t, sql_w, sql_o, limitby) source code
 
_fetchall(self) source code
 
_select_aux(self, sql, fields, attributes) source code
 
select(self, query, fields, attributes)
Always returns a Rows object, possibly empty.
source code
 
_count(self, query, distinct=None) source code
 
count(self, query, distinct=None) source code
 
tables(self, *queries) source code
 
commit(self) source code
 
rollback(self) source code
 
close_connection(self) source code
 
distributed_transaction_begin(self, key) source code
 
prepare(self, key) source code
 
commit_prepared(self, key) source code
 
rollback_prepared(self, key) source code
 
concat_add(self, tablename) source code
 
constraint_name(self, table, fieldname) source code
 
create_sequence_and_triggers(self, query, table, **args) source code
 
log_execute(self, *a, **b) source code
 
execute(self, *a, **b) source code
 
represent(self, obj, fieldtype) source code
 
represent_exceptions(self, obj, fieldtype) source code
 
lastrowid(self, table) source code
 
rowslice(self, rows, minimum=0, maximum=None)
By default this function does nothing; overload when db does not do slicing.
source code
 
parse_value(self, value, field_type, blob_decode=True) source code
 
parse_reference(self, value, field_type) source code
 
parse_boolean(self, value, field_type) source code
 
parse_date(self, value, field_type) source code
 
parse_time(self, value, field_type) source code
 
parse_datetime(self, value, field_type) source code
 
parse_blob(self, value, field_type) source code
 
parse_decimal(self, value, field_type) source code
 
parse_list_integers(self, value, field_type) source code
 
parse_list_references(self, value, field_type) source code
 
parse_list_strings(self, value, field_type) source code
 
parse_id(self, value, field_type) source code
 
parse_integer(self, value, field_type) source code
 
parse_double(self, value, field_type) source code
 
parse_json(self, value, field_type) source code
 
build_parsemap(self) source code
 
parse(self, rows, fields, colnames, blob_decode=True, cacheable=False) source code
 
common_filter(self, query, tablenames) source code
 
CASE(self, query, t, f) source code
 
sqlsafe_table(self, tablename, ot=None) source code
 
sqlsafe_field(self, fieldname) source code

Inherited from ConnectionPool: after_connection, after_connection_hook, close, find_or_make_work_folder, reconnect

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

Static Methods [hide private]

Inherited from ConnectionPool: close_all_instances, set_folder

Class Variables [hide private]
  native_json = False
  driver = None
hash(x)
  driver_name = None
hash(x)
  drivers = ()
  connection = None
hash(x)
  commit_on_alter_table = False
  support_distributed_transaction = False
  uploads_in_blob = False
  can_select_for_update = True
  dbpath = None
hash(x)
  folder = None
hash(x)
  TRUE = 'T'
  FALSE = 'F'
  T_SEP = ' '
  QUOTE_TEMPLATE = '"%s"'
  types = {'big-id': 'BIGINT PRIMARY KEY AUTOINCREMENT', 'big-re...

Inherited from ConnectionPool: POOLS, check_active_connection

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

log(self, message, table=None)

source code 

Logs migrations

It will not log changes if logfile is not specified. Defaults to sql.log

__init__(self, db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY at 0x334cd70>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

Class Variable Details [hide private]

types

Value:
{'big-id': 'BIGINT PRIMARY KEY AUTOINCREMENT',
 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_de\
lete_action)s',
 'bigint': 'INTEGER',
 'blob': 'BLOB',
 'boolean': 'CHAR(1)',
 'date': 'DATE',
 'datetime': 'TIMESTAMP',
...