Docs for DAL
Description
<type 'type'> extends (<type 'dict'>,)
|
Attributes
DAL.Field |
<type 'type'> extends (<class 'gluon.dal.Expression'>,)
belongs to class <type 'type'>
|
DAL.Table |
<type 'type'> extends (<type 'dict'>,)
belongs to class <type 'type'>
an instance of this class represents a database table Example:: db = DAL(...) db.define_table('users', Field('name')) db.users.insert(name='me') # print db.users._insert(...) to see SQL db.users.drop() |
DAL.__call__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__class__ |
<type 'type'> extends (<type 'object'>,)
belongs to class <type 'type'>
type(object) -> the object's type type(name, bases, dict) -> a new type |
DAL.__cmp__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__cmp__(y) <==> cmp(x,y) |
DAL.__contains__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__delattr__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__delattr__('name') <==> del x.name |
DAL.__delitem__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__delitem__(y) <==> del x[y] |
DAL.__dict__ |
<type 'dictproxy'>
belongs to class <type 'dictproxy'>
|
DAL.__doc__ |
<type 'str'>
belongs to class <type 'str'>
str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
DAL.__eq__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__eq__(y) <==> x==y |
DAL.__ge__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__ge__(y) <==> x>=y |
DAL.__getattr__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__getattribute__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__getattribute__('name') <==> x.name |
DAL.__getitem__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__gt__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__gt__(y) <==> x>y |
DAL.__hash__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__hash__() <==> hash(x) |
DAL.__init__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Creates a new Database Abstraction Layer instance. Keyword arguments: :uri: string that contains information for connecting to a database. (default: 'sqlite://dummy.db') :pool_size: How many open connections to make to the database object. :folder: <please update me> :db_codec: string encoding of the database (default: 'UTF-8') :check_reserved: list of adapters to check tablenames and column names against sql reserved keywords. (Default None) * 'common' List of sql keywords that are common to all database types such as "SELECT, INSERT". (recommended) * 'all' Checks against all known SQL keywords. (not recommended) <adaptername> Checks against the specific adapters list of keywords (recommended) * '<adaptername>_nonreserved' Checks against the specific adapters list of nonreserved keywords. (if available) :migrate (defaults to True) sets default migrate behavior for all tables :fake_migrate (defaults to False) sets default fake_migrate behavior for all tables :migrate_enabled (defaults to True). If set to False disables ALL migrations :fake_migrate_all (defaults to False). If sets to True fake migrates ALL tables :attempts (defaults to 5). Number of times to attempt connecting |
DAL.__iter__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__le__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__le__(y) <==> x<=y |
DAL.__len__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__len__() <==> len(x) |
DAL.__lt__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__lt__(y) <==> x<y |
DAL.__module__ |
<type 'str'>
belongs to class <type 'str'>
str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
DAL.__ne__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__ne__(y) <==> x!=y |
DAL.__new__ |
<type 'builtin_function_or_method'>
belongs to class <type 'builtin_function_or_method'>
T.__new__(S, ...) -> a new object with type S, a subtype of T |
DAL.__reduce__ |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
helper for pickle |
DAL.__reduce_ex__ |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
helper for pickle |
DAL.__repr__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__setattr__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__setitem__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.__str__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__str__() <==> str(x) |
DAL.__weakref__ |
<type 'getset_descriptor'>
belongs to class <type 'getset_descriptor'>
list of weak references to the object (if defined) |
DAL._update_referenced_by |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.check_reserved_keyword |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Validates ``name`` against SQL keywords Uses self.check_reserve which is a list of operators to use. self.check_reserved ['common', 'postgres', 'mysql'] self.check_reserved ['all'] |
DAL.clear |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.clear() -> None. Remove all items from D. |
DAL.commit |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.copy |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.copy() -> a shallow copy of D |
DAL.define_table |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.distributed_transaction_begin |
<type 'function'>
belongs to class <type 'function'>
|
DAL.distributed_transaction_commit |
<type 'function'>
belongs to class <type 'function'>
|
DAL.executesql |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
placeholders is optional and will always be None when using DAL. If using raw SQL with placeholders, placeholders may be a sequence of values to be substituted in or, (if supported by the DB driver), a dictionary with keys matching named placeholders in your SQL. Added 2009-12-05 "as_dict" optional argument. Will always be None when using DAL. If using raw SQL can be set to True and the results cursor returned by the DB driver will be converted to a sequence of dictionaries keyed with the db field names. Tested with SQLite but should work with any database since the cursor.description used to get field names is part of the Python dbi 2.0 specs. Results returned with as_dict=True are the same as those returned when applying .to_list() to a DAL query. [{field1: value1, field2: value2}, {field1: value1b, field2: value2b}] --bmeredyk |
DAL.export_to_csv_file |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.fromkeys |
<type 'builtin_function_or_method'>
belongs to class <type 'builtin_function_or_method'>
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None. |
DAL.get |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
DAL.has_key |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.has_key(k) -> True if D has a key k, else False |
DAL.import_from_csv_file |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.import_table_definitions |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.items |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.items() -> list of D's (key, value) pairs, as 2-tuples |
DAL.iteritems |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.iteritems() -> an iterator over the (key, value) items of D |
DAL.iterkeys |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.iterkeys() -> an iterator over the keys of D |
DAL.itervalues |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.itervalues() -> an iterator over the values of D |
DAL.keys |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.keys() -> list of D's keys |
DAL.parse_as_rest |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
EXAMPLE: db.define_table('person',Field('name'),Field('info')) db.define_table('pet',Field('owner',db.person),Field('name'),Field('info')) @request.restful() def index(): def GET(*args,**vars): patterns = [ "/friends[person]", "/{friend.name.startswith}", "/{friend.name}/:field", "/{friend.name}/pets[pet.owner]", "/{friend.name}/pet[pet.owner]/{pet.name}", "/{friend.name}/pet[pet.owner]/{pet.name}/:field" ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'person': return db.person.validate_and_insert(**vars) elif table_name == 'pet': return db.pet.validate_and_insert(**vars) else: raise HTTP(400) return locals() |
DAL.pop |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.pop(k[,d]) -> v, remove specified key and return the corresponding value If key is not found, d is returned if given, otherwise KeyError is raised |
DAL.popitem |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty |
DAL.rollback |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.set_folder |
<type 'function'>
belongs to class <type 'function'>
# ## this allows gluon to set a folder for this thread # ## <<<<<<<<< Should go away as new DAL replaces old sql.py |
DAL.setdefault |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
DAL.smart_query |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
DAL.tables |
<type 'property'>
belongs to class <type 'property'>
|
DAL.update |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k] |
DAL.values |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
D.values() -> list of D's values |