本文整理汇总了Python中gluon.DAL属性的典型用法代码示例。如果您正苦于以下问题:Python gluon.DAL属性的具体用法?Python gluon.DAL怎么用?Python gluon.DAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gluon
的用法示例。
在下文中一共展示了gluon.DAL属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getDal
# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import DAL [as 别名]
def _getDal(self):
mDal = None
if self.dalPath is not None:
global DAL
sys.path.append(self.dalPath)
mDal = __import__(
'dal', globals={}, locals={}, fromlist=['DAL'], level=0)
DAL = mDal.DAL
return mDal
示例2: instDB
# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import DAL [as 别名]
def instDB(self, storageFolder, storageConnectionString, autoImport):
self.db = DAL(storageConnectionString, folder=os.path.abspath(
storageFolder), auto_import=autoImport)
return self.db
示例3: copyDB
# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import DAL [as 别名]
def copyDB(self):
other_db = DAL("%s://%s" % (
self.targetdbType, self.targetdbName), folder=self.targetFolder)
print 'creating tables...'
for table in self.db:
other_db.define_table(
table._tablename, *[field for field in table])
'''
should there be an option to truncAte target DB?
if yes, then change args to allow for choice
and set self.trancate to the art value
if self.truncate==True:
other_db[table._tablename].truncate()
'''
print 'exporting data...'
self.db.export_to_csv_file(open('tmp.sql', 'wb'))
print 'importing data...'
other_db.import_from_csv_file(open_file('tmp.sql', 'rb'))
other_db.commit()
print 'done!'
print 'Attention: do not run this program again or you end up with duplicate records'
示例4: copyDB
# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import DAL [as 别名]
def copyDB(self):
other_db = DAL("%s://%s" % (
self.targetdbType, self.targetdbName), folder=self.targetFolder)
print 'creating tables...'
for table in self.db:
other_db.define_table(
table._tablename, *[field for field in table])
'''
should there be an option to truncAte target DB?
if yes, then change args to allow for choice
and set self.trancate to the art value
if self.truncate==True:
other_db[table._tablename].truncate()
'''
print 'exporting data...'
self.db.export_to_csv_file(open('tmp.sql', 'wb'))
print 'importing data...'
other_db.import_from_csv_file(open('tmp.sql', 'rb'))
other_db.commit()
print 'done!'
print 'Attention: do not run this program again or you end up with duplicate records'