pydal.adapters package¶
Submodules¶
pydal.adapters.base module¶
-
class
pydal.adapters.base.
AdapterMeta
[source]¶ Bases:
type
Metaclass to support manipulation of adapter classes.
At the moment is used to intercept entity_quoting argument passed to DAL.
-
class
pydal.adapters.base.
BaseAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.connection.ConnectionPool
-
FALSE
= 'F'¶
-
FALSE_exp
= '0'¶
-
QUOTE_TEMPLATE
= '"%s"'¶
-
TRUE
= 'T'¶
-
TRUE_exp
= '1'¶
-
T_SEP
= ' '¶
-
can_select_for_update
= True¶
-
commit_on_alter_table
= False¶
-
connection
= None¶
-
connector
(*args, **kwargs)¶
-
current_cursor_in_use
= False¶
-
cursors_in_use
= []¶
-
dbpath
= None¶
-
driver
= None¶
-
driver_auto_json
= []¶
-
driver_name
= None¶
-
drivers
= ()¶
-
folder
= None¶
-
iterparse
(sql, fields, colnames, blob_decode=True, cacheable=False)[source]¶ Iterator to parse one row at a time. It doen’t support the old style virtual fields
-
log
(message, table=None)[source]¶ Logs migrations
It will not log changes if logfile is not specified. Defaults to sql.log
-
migrate_table
(table, sql_fields, sql_fields_old, sql_fields_aux, logfile, fake_migrate=False)[source]¶
-
rowslice
(rows, minimum=0, maximum=None)[source]¶ By default this function does nothing; overload when db does not do slicing.
-
support_distributed_transaction
= False¶
-
test_query
= 'SELECT 1;'¶
-
types
= {'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'text': 'TEXT', 'float': 'DOUBLE', 'datetime': 'TIMESTAMP', 'bigint': 'INTEGER', 'id': 'INTEGER PRIMARY KEY AUTOINCREMENT', 'reference FK': ', CONSTRAINT "FK_%(constraint_name)s" FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'json': 'TEXT', 'big-id': 'INTEGER PRIMARY KEY AUTOINCREMENT', 'blob': 'BLOB', 'big-reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'string': 'CHAR(%(length)s)', 'list:string': 'TEXT', 'date': 'DATE', 'integer': 'INTEGER', 'password': 'CHAR(%(length)s)', 'list:integer': 'TEXT', 'double': 'DOUBLE', 'decimal': 'DOUBLE', 'upload': 'CHAR(%(length)s)', 'list:reference': 'TEXT', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
uploads_in_blob
= False¶
-
-
class
pydal.adapters.base.
NoSQLAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
QUOTE_TEMPLATE
= '%s'¶
-
can_select_for_update
= False¶
-
pydal.adapters.couchdb module¶
-
class
pydal.adapters.couchdb.
CouchDBAdapter
(db, uri='couchdb://127.0.0.1:5984', pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.NoSQLAdapter
-
drivers
= ('couchdb',)¶
-
types
= {'string': <type 'str'>, 'reference': <type 'long'>, 'text': <type 'str'>, 'id': <type 'long'>, 'float': <type 'float'>, 'bigint': <type 'long'>, 'upload': <type 'str'>, 'datetime': <type 'datetime.datetime'>, 'json': <type 'str'>, 'boolean': <type 'bool'>, 'blob': <type 'str'>, 'list:string': <type 'list'>, 'double': <type 'float'>, 'date': <type 'datetime.date'>, 'integer': <type 'long'>, 'password': <type 'str'>, 'list:integer': <type 'list'>, 'time': <type 'datetime.time'>, 'list:reference': <type 'list'>}¶
-
uploads_in_blob
= True¶
-
pydal.adapters.cubrid module¶
-
class
pydal.adapters.cubrid.
CubridAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.mysql.MySQLAdapter
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b4d260>¶
-
drivers
= ('cubriddb',)¶
-
pydal.adapters.db2 module¶
-
class
pydal.adapters.db2.
DB2Adapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
drivers
= ('ibm_db_dbi', 'pyodbc')¶
-
types
= {'reference': 'INT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'CLOB', 'float': 'REAL', 'datetime': 'TIMESTAMP', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'json': 'CLOB', 'big-id': 'BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL', 'blob': 'BLOB', 'big-reference': 'BIGINT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'CLOB', 'date': 'DATE', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'CLOB', 'double': 'DOUBLE', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'CLOB', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
pydal.adapters.firebird module¶
-
class
pydal.adapters.firebird.
FireBirdAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b0ffd0>¶
-
commit_on_alter_table
= True¶
-
drivers
= ('kinterbasdb', 'firebirdsql', 'fdb', 'pyodbc')¶
-
support_distributed_transaction
= True¶
-
types
= {'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'BLOB SUB_TYPE 1', 'float': 'FLOAT', 'datetime': 'TIMESTAMP', 'bigint': 'BIGINT', 'id': 'INTEGER PRIMARY KEY', 'json': 'BLOB SUB_TYPE 1', 'big-id': 'BIGINT PRIMARY KEY', 'blob': 'BLOB SUB_TYPE 0', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'BLOB SUB_TYPE 1', 'date': 'DATE', 'integer': 'INTEGER', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'BLOB SUB_TYPE 1', 'double': 'DOUBLE PRECISION', 'decimal': 'DECIMAL(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'BLOB SUB_TYPE 1', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
-
class
pydal.adapters.firebird.
FireBirdEmbeddedAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.firebird.FireBirdAdapter
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b68790>¶
-
drivers
= ('kinterbasdb', 'firebirdsql', 'fdb', 'pyodbc')¶
-
pydal.adapters.google_adapters module¶
Adapter for GAE
pydal.adapters.imap module¶
-
class
pydal.adapters.imap.
IMAPAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.NoSQLAdapter
IMAP server adapter
This class is intended as an interface with email IMAP servers to perform simple queries in the web2py DAL query syntax, so email read, search and other related IMAP mail services (as those implemented by brands like Google(r), and Yahoo!(r) can be managed from web2py applications.
The code uses examples by Yuji Tomita on this post: http://yuji.wordpress.com/2011/06/22/python-imaplib-imap-example-with-gmail/#comment-1137 and is based in docs for Python imaplib, python email and email IETF’s (i.e. RFC2060 and RFC3501)
This adapter was tested with a small set of operations with Gmail(r). Other services requests could raise command syntax and response data issues.
It creates its table and field names “statically”, meaning that the developer should leave the table and field definitions to the DAL instance by calling the adapter’s .define_tables() method. The tables are defined with the IMAP server mailbox list information.
.define_tables() returns a dictionary mapping dal tablenames to the server mailbox names with the following structure:
{<tablename>: str <server mailbox name>}
Here is a list of supported fields:
Field Type Description uid string answered boolean Flag created date content list:string A list of dict text or html parts to string cc string bcc string size integer the amount of octets of the message* deleted boolean Flag draft boolean Flag flagged boolean Flag sender string recent boolean Flag seen boolean Flag subject string mime string The mime header declaration email string The complete RFC822 message (*) attachments list Each non text part as dict encoding string The main detected encoding (*) At the application side it is measured as the length of the RFC822 message string
WARNING: As row id’s are mapped to email sequence numbers, make sure your imap client web2py app does not delete messages during select or update actions, to prevent updating or deleting different messages. Sequence numbers change whenever the mailbox is updated. To avoid this sequence numbers issues, it is recommended the use of uid fields in query references (although the update and delete in separate actions rule still applies).
# This is the code recommended to start imap support # at the app's model: imapdb = DAL("imap://user:password@server:port", pool_size=1) # port 993 for ssl imapdb.define_tables()
Here is an (incomplete) list of possible imap commands:
# Count today's unseen messages # smaller than 6000 octets from the # inbox mailbox q = imapdb.INBOX.seen == False q &= imapdb.INBOX.created == datetime.date.today() q &= imapdb.INBOX.size < 6000 unread = imapdb(q).count() # Fetch last query messages rows = imapdb(q).select() # it is also possible to filter query select results with limitby and # sequences of mailbox fields set.select(<fields sequence>, limitby=(<int>, <int>)) # Mark last query messages as seen messages = [row.uid for row in rows] seen = imapdb(imapdb.INBOX.uid.belongs(messages)).update(seen=True) # Delete messages in the imap database that have mails from mr. Gumby deleted = 0 for mailbox in imapdb.tables deleted += imapdb(imapdb[mailbox].sender.contains("gumby")).delete() # It is possible also to mark messages for deletion instead of ereasing them # directly with set.update(deleted=True) # This object give access # to the adapter auto mailbox # mapped names (which native # mailbox has what table name) imapdb.mailboxes <dict> # tablename, server native name pairs # To retrieve a table native mailbox name use: imapdb.<table>.mailbox ### New features v2.4.1: # Declare mailboxes statically with tablename, name pairs # This avoids the extra server names retrieval imapdb.define_tables({"inbox": "INBOX"}) # Selects without content/attachments/email columns will only # fetch header and flags imapdb(q).select(imapdb.INBOX.sender, imapdb.INBOX.subject)
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b3a8d0>¶
-
dbengine
= 'imap'¶
-
define_tables
(mailbox_names=None)[source]¶ Auto create common IMAP fileds
This function creates fields definitions “statically” meaning that custom fields as in other adapters should not be supported and definitions handled on a service/mode basis (local syntax for Gmail(r), Ymail(r)
Returns a dictionary with tablename, server native mailbox name pairs.
-
drivers
= ('imaplib',)¶
-
reconnect
(f=None)[source]¶ IMAP4 Pool connection method
imap connection lacks of self cursor command. A custom command should be provided as a replacement for connection pooling to prevent uncaught remote session closing
-
types
= {'boolean': <type 'bool'>, 'string': <type 'str'>, 'list:string': <type 'str'>, 'integer': <type 'int'>, 'date': <type 'datetime.date'>, 'text': <type 'str'>, 'blob': <type 'str'>, 'bigint': <type 'long'>, 'id': <type 'long'>, 'datetime': <type 'datetime.datetime'>}¶
-
uri
= None¶ MESSAGE is an identifier for sequence number
-
pydal.adapters.informix module¶
-
class
pydal.adapters.informix.
InformixAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b94a70>¶
-
drivers
= ('informixdb',)¶
-
types
= {'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'BLOB SUB_TYPE 1', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': 'FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s CONSTRAINT TFK_%(table_name)s_%(field_name)s', 'id': 'SERIAL', 'reference FK': 'REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s CONSTRAINT FK_%(table_name)s_%(field_name)s', 'json': 'BLOB SUB_TYPE 1', 'big-id': 'BIGSERIAL', 'blob': 'BLOB SUB_TYPE 0', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'BLOB SUB_TYPE 1', 'date': 'DATE', 'integer': 'INTEGER', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'BLOB SUB_TYPE 1', 'double': 'DOUBLE PRECISION', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'BLOB SUB_TYPE 1', 'boolean': 'CHAR(1)', 'time': 'CHAR(8)'}¶
-
-
class
pydal.adapters.informix.
InformixSEAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.informix.InformixAdapter
work in progress
pydal.adapters.ingres module¶
-
class
pydal.adapters.ingres.
IngresAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
drivers
= ('pyodbc',)¶
-
types
= {'reference': 'INT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'CLOB', 'float': 'FLOAT', 'datetime': 'TIMESTAMP WITHOUT TIME ZONE', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'int not null unique with default next value for ii***lineitemsequence', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'json': 'CLOB', 'big-id': 'bigint not null unique with default next value for ii***lineitemsequence', 'blob': 'BLOB', 'big-reference': 'BIGINT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'CLOB', 'date': 'ANSIDATE', 'integer': 'INTEGER4', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'CLOB', 'double': 'FLOAT8', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'CLOB', 'boolean': 'CHAR(1)', 'time': 'TIME WITHOUT TIME ZONE'}¶
-
-
class
pydal.adapters.ingres.
IngresUnicodeAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.ingres.IngresAdapter
-
drivers
= ('pyodbc',)¶
-
types
= {'reference': 'INTEGER4, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'NCLOB', 'float': 'FLOAT', 'datetime': 'TIMESTAMP WITHOUT TIME ZONE', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INTEGER4 not null unique with default next value for ii***lineitemsequence', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'json': 'NCLOB', 'big-id': 'BIGINT not null unique with default next value for ii***lineitemsequence', 'blob': 'BLOB', 'big-reference': 'BIGINT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'NVARCHAR(%(length)s)', 'list:string': 'NCLOB', 'date': 'ANSIDATE', 'integer': 'INTEGER4', 'password': 'NVARCHAR(%(length)s)', 'list:integer': 'NCLOB', 'double': 'FLOAT8', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'NCLOB', 'boolean': 'CHAR(1)', 'time': 'TIME WITHOUT TIME ZONE'}¶
-
pydal.adapters.mongo module¶
-
class
pydal.adapters.mongo.
MongoBlob
[source]¶ Bases:
pydal.adapters.mongo.Binary
-
MONGO_BLOB_BYTES
= 0¶
-
MONGO_BLOB_NON_UTF8_STR
= 1¶
-
-
class
pydal.adapters.mongo.
MongoDBAdapter
(db, uri='mongodb://127.0.0.1:5984/db', pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.NoSQLAdapter
-
AS_MARK
= '__#AS#__'¶
-
class
Expanded
(adapter, crud, query, fields=(), tablename=None, groupby=None, distinct=False, having=None)[source]¶ Bases:
object
Class to encapsulate a pydal expression and track the parse expansion and its results.
Two different MongoDB mechanisms are targeted here. If the query is sufficiently simple, then simple queries are generated. The bulk of the complexity here is however to support more complex queries that are targeted to the MongoDB Aggregation Pipeline.
This class supports four operations: ‘count’, ‘select’, ‘update’ and ‘delete’.
Behavior varies somewhat for each operation type. However building each pipeline stage is shared where the behavior is the same (or similar) for the different operations.
In general an attempt is made to build the query without using the pipeline, and if that fails then the query is rebuilt with the pipeline.
- QUERY constructed in _build_pipeline_query():
- $project : used to calculate expressions if needed $match: filters out records
- FIELDS constructed in _expand_fields():
- FIELDS:COUNT
- $group : filter for distinct if needed $group: count the records remaining
- FIELDS:SELECT
- $group : implement aggregations if needed $project: implement expressions (etc) for select
- FIELDS:UPDATE
- $project: implement expressions (etc) for update
- HAVING constructed in _add_having():
- $project : used to calculate expressions $match: filters out records $project : used to filter out previous expression fields
-
MongoDBAdapter.
GROUP_MARK
= '__#GROUP#__'¶
-
MongoDBAdapter.
LENGTH
(first)[source]¶ https://jira.mongodb.org/browse/SERVER-5319 https://github.com/afchin/mongo/commit/f52105977e4d0ccb53bdddfb9c4528a3f3c40bdf
-
exception
MongoDBAdapter.
NotOnNoSqlError
(message=None)[source]¶ Bases:
exceptions.NotImplementedError
-
MongoDBAdapter.
RANDOM
()[source]¶ ORDER BY RANDOM()
https://github.com/mongodb/cookbook/blob/master/content/patterns/random-attribute.txt https://jira.mongodb.org/browse/SERVER-533 http://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql
-
MongoDBAdapter.
REGEXP
(first, second, case_sensitive=True)[source]¶ MongoDB provides regular expression capabilities for pattern matching strings in queries. MongoDB uses Perl compatible regular expressions (i.e. ‘PCRE’) version 8.36 with UTF-8 support.
-
MongoDBAdapter.
REGEXP_MARK1
= '__#REGEXP_1#__'¶
-
MongoDBAdapter.
REGEXP_MARK2
= '__#REGEXP_2#__'¶
-
MongoDBAdapter.
REGEX_SELECT_AS_PARSER
= <_sre.SRE_Pattern object>¶
-
MongoDBAdapter.
driver_auto_json
= ['loads', 'dumps']¶
-
MongoDBAdapter.
drivers
= ('pymongo',)¶
-
MongoDBAdapter.
insert
(table, fields, safe=None)[source]¶ Safe determines whether a asynchronous request is done or a synchronous action is done For safety, we use by default synchronous requests
-
MongoDBAdapter.
object_id
(arg=None)[source]¶ Convert input to a valid Mongodb ObjectId instance
self.object_id(“<random>”) -> ObjectId (not unique) instance
-
MongoDBAdapter.
types
= {'string': <type 'str'>, 'reference': <type 'long'>, 'text': <type 'str'>, 'id': <type 'long'>, 'float': <type 'float'>, 'bigint': <type 'long'>, 'upload': <type 'str'>, 'datetime': <type 'datetime.datetime'>, 'json': <type 'str'>, 'boolean': <type 'bool'>, 'blob': <type 'str'>, 'list:string': <type 'list'>, 'double': <type 'float'>, 'date': <type 'datetime.date'>, 'integer': <type 'long'>, 'password': <type 'str'>, 'list:integer': <type 'list'>, 'time': <type 'datetime.time'>, 'list:reference': <type 'list'>}¶
-
MongoDBAdapter.
uploads_in_blob
= False¶
-
pydal.adapters.mssql module¶
-
class
pydal.adapters.mssql.
MSSQL2Adapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLAdapter
-
drivers
= ('pyodbc',)¶
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'NTEXT', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'NTEXT', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'NVARCHAR(%(length)s)', 'list:string': 'NTEXT', 'date': 'DATETIME', 'integer': 'INT', 'password': 'NVARCHAR(%(length)s)', 'list:integer': 'NTEXT', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'NVARCHAR(%(length)s)', 'list:reference': 'NTEXT', 'boolean': 'BIT', 'time': 'CHAR(8)'}¶
-
-
class
pydal.adapters.mssql.
MSSQL3Adapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLAdapter
Experimental support for pagination in MSSQL
Requires MSSQL >= 2005, uses ROW_NUMBER()
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'VARCHAR(MAX)', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'VARCHAR(MAX)', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'VARCHAR(MAX)', 'date': 'DATETIME', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'VARCHAR(MAX)', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'VARCHAR(MAX)', 'boolean': 'BIT', 'time': 'TIME(7)'}¶
-
-
class
pydal.adapters.mssql.
MSSQL3NAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLNAdapter
-
drivers
= ('pyodbc',)¶ Experimental support for pagination in MSSQL Experimental: see MSSQLNAdapter docstring for warnings
Requires MSSQL >= 2005, uses ROW_NUMBER()
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'NVARCHAR(MAX)', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'NVARCHAR(MAX)', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'NVARCHAR(%(length)s)', 'list:string': 'NVARCHAR(MAX)', 'date': 'DATETIME', 'integer': 'INT', 'password': 'NVARCHAR(%(length)s)', 'list:integer': 'NVARCHAR(MAX)', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'NVARCHAR(%(length)s)', 'list:reference': 'NVARCHAR(MAX)', 'boolean': 'BIT', 'time': 'TIME(7)'}¶
-
-
class
pydal.adapters.mssql.
MSSQL4Adapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLAdapter
Support for “native” pagination
Requires MSSQL >= 2012, uses OFFSET ... ROWS ... FETCH NEXT ... ROWS ONLY
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'VARCHAR(MAX)', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'VARCHAR(MAX)', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'VARCHAR(MAX)', 'date': 'DATETIME', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'VARCHAR(MAX)', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'VARCHAR(MAX)', 'boolean': 'BIT', 'time': 'TIME(7)'}¶
-
-
class
pydal.adapters.mssql.
MSSQL4NAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLNAdapter
Experimental: see MSSQLNAdapter docstring for warnings Support for “native” pagination
Unicode-compatible version Requires MSSQL >= 2012, uses OFFSET ... ROWS ... FETCH NEXT ... ROWS ONLY After careful testing, this should be the de-facto adapter for recent MSSQL backends
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'NVARCHAR(MAX)', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'NVARCHAR(MAX)', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'NVARCHAR(%(length)s)', 'list:string': 'NVARCHAR(MAX)', 'date': 'DATE', 'integer': 'INT', 'password': 'NVARCHAR(%(length)s)', 'list:integer': 'NVARCHAR(MAX)', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'NVARCHAR(%(length)s)', 'list:reference': 'NVARCHAR(MAX)', 'boolean': 'BIT', 'time': 'TIME(7)'}¶
-
-
class
pydal.adapters.mssql.
MSSQLAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
FALSE
= 0¶
-
QUOTE_TEMPLATE
= '"%s"'¶
-
REGEX_ARGPATTERN
= <_sre.SRE_Pattern object>¶
-
REGEX_DSN
= <_sre.SRE_Pattern object>¶
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2c1ef50>¶
-
TRUE
= 1¶
-
T_SEP
= 'T'¶
-
drivers
= ('pyodbc',)¶
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'TEXT', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'TEXT', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'TEXT', 'date': 'DATETIME', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'TEXT', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'TEXT', 'boolean': 'BIT', 'time': 'CHAR(8)'}¶
-
-
class
pydal.adapters.mssql.
MSSQLNAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLAdapter
-
drivers
= ('pyodbc',)¶ Experimental – base class for handling unicode in MSSQL by default. Needs lots of testing. Try this on a fresh (or on a legacy) database. Using this in a database handled previously with non-unicode aware adapter is NOT supported
-
types
= {'reference': 'INT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'NTEXT', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'NTEXT', 'blob': 'IMAGE', 'big-reference': 'BIGINT %(null)s %(unique)s, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'NVARCHAR(%(length)s)', 'list:string': 'NTEXT', 'date': 'DATETIME', 'integer': 'INT', 'password': 'NVARCHAR(%(length)s)', 'list:integer': 'NTEXT', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'NVARCHAR(%(length)s)', 'list:reference': 'NTEXT', 'boolean': 'BIT', 'time': 'CHAR(8)'}¶
-
-
class
pydal.adapters.mssql.
SybaseAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLAdapter
-
drivers
= 'Sybase'¶
-
types
= {'reference': 'INT NULL, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'TEXT', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'INT IDENTITY PRIMARY KEY', 'geography': 'geography', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGINT IDENTITY PRIMARY KEY', 'json': 'TEXT', 'blob': 'IMAGE', 'big-reference': 'BIGINT NULL, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'CHAR VARYING(%(length)s)', 'list:string': 'TEXT', 'date': 'DATETIME', 'integer': 'INT', 'password': 'CHAR VARYING(%(length)s)', 'list:integer': 'TEXT', 'geometry': 'geometry', 'double': 'FLOAT', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'CHAR VARYING(%(length)s)', 'list:reference': 'TEXT', 'boolean': 'BIT', 'time': 'CHAR(8)'}¶
-
-
class
pydal.adapters.mssql.
VerticaAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.mssql.MSSQLAdapter
-
T_SEP
= ' '¶
-
drivers
= ('pyodbc',)¶
-
types
= {'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'reference': 'INT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'BYTEA', 'decimal': 'DECIMAL(%(precision)s,%(scale)s)', 'float': 'FLOAT', 'bigint': 'BIGINT', 'upload': 'VARCHAR(%(length)s)', 'datetime': 'DATETIME', 'json': 'VARCHAR(%(length)s)', 'boolean': 'BOOLEAN', 'id': 'IDENTITY', 'blob': 'BYTEA', 'list:string': 'BYTEA', 'double': 'DOUBLE PRECISION', 'date': 'DATE', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'BYTEA', 'time': 'TIME', 'list:reference': 'BYTEA'}¶
-
pydal.adapters.mysql module¶
-
class
pydal.adapters.mysql.
MySQLAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
QUOTE_TEMPLATE
= '`%s`'¶
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b4d260>¶
-
commit_on_alter_table
= True¶
-
drivers
= ('MySQLdb', 'pymysql', 'mysqlconnector')¶
-
support_distributed_transaction
= True¶
-
types
= {'reference': 'INT %(null)s %(unique)s, INDEX %(index_name)s (%(field_name)s), FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'LONGTEXT', 'float': 'FLOAT', 'datetime': 'DATETIME', 'bigint': 'BIGINT', 'id': 'INT AUTO_INCREMENT NOT NULL', 'reference FK': ', CONSTRAINT `FK_%(constraint_name)s` FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'json': 'LONGTEXT', 'big-id': 'BIGINT AUTO_INCREMENT NOT NULL', 'blob': 'LONGBLOB', 'big-reference': 'BIGINT %(null)s %(unique)s, INDEX %(index_name)s (%(field_name)s), FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'LONGTEXT', 'date': 'DATE', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'LONGTEXT', 'double': 'DOUBLE', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'LONGTEXT', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
pydal.adapters.oracle module¶
-
class
pydal.adapters.oracle.
OracleAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
commit_on_alter_table
= False¶
-
drivers
= ('cx_Oracle',)¶
-
oracle_fix
= <_sre.SRE_Pattern object>¶
-
types
= {'reference': 'NUMBER, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'CLOB', 'float': 'FLOAT', 'datetime': 'DATE', 'bigint': 'NUMBER', 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'NUMBER PRIMARY KEY', 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'json': 'CLOB', 'big-id': 'NUMBER PRIMARY KEY', 'blob': 'CLOB', 'big-reference': 'NUMBER, CONSTRAINT %(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR2(%(length)s)', 'list:string': 'CLOB', 'date': 'DATE', 'integer': 'INT', 'password': 'VARCHAR2(%(length)s)', 'list:integer': 'CLOB', 'double': 'BINARY_DOUBLE', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR2(%(length)s)', 'list:reference': 'CLOB', 'boolean': 'CHAR(1)', 'time': 'CHAR(8)'}¶
-
pydal.adapters.postgres module¶
-
class
pydal.adapters.postgres.
JDBCPostgreSQLAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.postgres.PostgreSQLAdapter
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b94a70>¶
-
drivers
= ('zxJDBC',)¶
-
-
class
pydal.adapters.postgres.
NewPostgreSQLAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.postgres.PostgreSQLAdapter
-
drivers
= ('psycopg2', 'pg8000')¶
-
types
= {'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'text': 'TEXT', 'float': 'FLOAT', 'datetime': 'TIMESTAMP', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT "FK_%(foreign_table)s_PK" FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'SERIAL PRIMARY KEY', 'geography': 'GEOGRAPHY', 'reference FK': ', CONSTRAINT "FK_%(constraint_name)s" FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGSERIAL PRIMARY KEY', 'json': 'TEXT', 'blob': 'BYTEA', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'TEXT[]', 'date': 'DATE', 'integer': 'INTEGER', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'BIGINT[]', 'geometry': 'GEOMETRY', 'double': 'FLOAT8', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'BIGINT[]', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
-
class
pydal.adapters.postgres.
PostgreSQLAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
QUOTE_TEMPLATE
= '"%s"'¶
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b96520>¶
-
drivers
= ('psycopg2', 'pg8000')¶
-
support_distributed_transaction
= True¶
-
types
= {'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'text': 'TEXT', 'float': 'FLOAT', 'datetime': 'TIMESTAMP', 'bigint': 'BIGINT', 'reference TFK': ' CONSTRAINT "FK_%(foreign_table)s_PK" FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', 'id': 'SERIAL PRIMARY KEY', 'geography': 'GEOGRAPHY', 'reference FK': ', CONSTRAINT "FK_%(constraint_name)s" FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-id': 'BIGSERIAL PRIMARY KEY', 'json': 'TEXT', 'blob': 'BYTEA', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'TEXT', 'date': 'DATE', 'integer': 'INTEGER', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'TEXT', 'geometry': 'GEOMETRY', 'double': 'FLOAT8', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'TEXT', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
pydal.adapters.sapdb module¶
-
class
pydal.adapters.sapdb.
SAPDBAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
REGEX_URI
= <_sre.SRE_Pattern object at 0x2b96520>¶
-
drivers
= ('sapdb',)¶
-
support_distributed_transaction
= False¶
-
types
= {'reference': 'INT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'LONG', 'float': 'FLOAT', 'datetime': 'TIMESTAMP', 'bigint': 'BIGINT', 'id': 'INT PRIMARY KEY', 'json': 'LONG', 'big-id': 'BIGINT PRIMARY KEY', 'blob': 'LONG', 'big-reference': 'BIGINT, FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'string': 'VARCHAR(%(length)s)', 'list:string': 'LONG', 'date': 'DATE', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'LONG', 'double': 'DOUBLE PRECISION', 'decimal': 'FIXED(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'LONG', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-
pydal.adapters.sqlite module¶
-
class
pydal.adapters.sqlite.
JDBCSQLiteAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.sqlite.SQLiteAdapter
-
drivers
= ('zxJDBC_sqlite',)¶
-
-
class
pydal.adapters.sqlite.
SQLiteAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
can_select_for_update
= None¶
-
drivers
= ('sqlite2', 'sqlite3')¶
-
-
class
pydal.adapters.sqlite.
SpatiaLiteAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, srid=4326, after_connection=None)[source]¶ Bases:
pydal.adapters.sqlite.SQLiteAdapter
-
drivers
= ('sqlite3', 'sqlite2')¶
-
types
= {'string': 'CHAR(%(length)s)', 'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s', 'text': 'TEXT', 'float': 'DOUBLE', 'datetime': 'TIMESTAMP', 'bigint': 'INTEGER', 'list:string': 'TEXT', 'date': 'DATE', 'integer': 'INTEGER', 'password': 'CHAR(%(length)s)', 'list:integer': 'TEXT', 'id': 'INTEGER PRIMARY KEY AUTOINCREMENT', 'reference FK': ', CONSTRAINT "FK_%(constraint_name)s" FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'geometry': 'GEOMETRY', 'double': 'DOUBLE', 'decimal': 'DOUBLE', 'big-id': 'INTEGER PRIMARY KEY AUTOINCREMENT', 'list:reference': 'TEXT', 'json': 'TEXT', 'boolean': 'CHAR(1)', 'upload': 'CHAR(%(length)s)', 'blob': 'BLOB', 'time': 'TIME', 'big-reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s %(null)s %(unique)s'}¶
-
pydal.adapters.teradata module¶
-
class
pydal.adapters.teradata.
TeradataAdapter
(db, uri, pool_size=0, folder=None, db_codec='UTF-8', credential_decoder=<function IDENTITY>, driver_args={}, adapter_args={}, do_connect=True, after_connection=None)[source]¶ Bases:
pydal.adapters.base.BaseAdapter
-
drivers
= ('pyodbc',)¶
-
types
= {'reference': 'INT', 'text': 'VARCHAR(2000)', 'float': 'REAL', 'datetime': 'TIMESTAMP', 'bigint': 'BIGINT', 'reference TFK': ' FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s)', 'id': 'INT GENERATED ALWAYS AS IDENTITY', 'reference FK': ' REFERENCES %(foreign_key)s', 'json': 'VARCHAR(4000)', 'big-id': 'BIGINT GENERATED ALWAYS AS IDENTITY', 'blob': 'BLOB', 'big-reference': 'BIGINT', 'string': 'VARCHAR(%(length)s)', 'list:string': 'VARCHAR(4000)', 'date': 'DATE', 'integer': 'INT', 'password': 'VARCHAR(%(length)s)', 'list:integer': 'VARCHAR(4000)', 'geometry': 'ST_GEOMETRY', 'double': 'DOUBLE', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'upload': 'VARCHAR(%(length)s)', 'list:reference': 'VARCHAR(4000)', 'boolean': 'CHAR(1)', 'time': 'TIME'}¶
-