db.define_table(...table_hash=...) to override hash in .table file, thanks dmvieira

This commit is contained in:
mdipierro
2014-03-29 17:19:12 -05:00
parent 338a4256ca
commit 49f4e38658
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.9.5-trunk+timestamp.2014.03.29.17.06.19
Version 2.9.5-trunk+timestamp.2014.03.29.17.18.01
+5 -2
View File
@@ -7648,6 +7648,9 @@ class DAL(object):
folder: where .table files will be created. Automatically set within
web2py. Use an explicit path when using DAL outside web2py
db_codec: string encoding of the database (default: 'UTF-8')
table_hash: database identifier with .tables. If your connection hash
change you can still using old .tables if they have db_hash
as prefix
check_reserved: list of adapters to check tablenames and column names
against sql/nosql reserved keywords. Defaults to `None`
@@ -7798,7 +7801,7 @@ class DAL(object):
bigint_id=False, debug=False, lazy_tables=False,
db_uid=None, do_connect=True,
after_connection=None, tables=None, ignore_field_case=True,
entity_quoting=False):
entity_quoting=False, table_hash=None):
if uri == '<zombie>' and db_uid is not None: return
if not decode_credentials:
@@ -7887,7 +7890,7 @@ class DAL(object):
entity_quoting=entity_quoting)
migrate = fake_migrate = False
adapter = self._adapter
self._uri_hash = hashlib_md5(adapter.uri).hexdigest()
self._uri_hash = table_hash or hashlib_md5(adapter.uri).hexdigest()
self.check_reserved = check_reserved
if self.check_reserved:
from reserved_sql_keywords import ADAPTERS as RSK