當前位置: 首頁>>代碼示例>>Python>>正文


Python gluon.DAL屬性代碼示例

本文整理匯總了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 
開發者ID:HackPucBemobi,項目名稱:touch-pay-client,代碼行數:11,代碼來源:cpdb.py

示例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 
開發者ID:HackPucBemobi,項目名稱:touch-pay-client,代碼行數:6,代碼來源:cpdb.py

示例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' 
開發者ID:HackPucBemobi,項目名稱:touch-pay-client,代碼行數:28,代碼來源:cpdb.py

示例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' 
開發者ID:lucadealfaro,項目名稱:true_review_web2py,代碼行數:28,代碼來源:cpdb.py


注:本文中的gluon.DAL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。