/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Static Public Attributes | Properties
DybPython::dbcas::DBCas Class Reference

List of all members.

Public Member Functions

def __init__
def dump
def Dump
def spawn

Public Attributes

 cnf

Static Public Attributes

tuple Dump = classmethod(Dump)

Properties

 url = property(lambda self:";".join([_.url for _ in self]))
 user = property(lambda self:";".join([_.user for _ in self]))
 pswd = property(lambda self:";".join([_.pswd for _ in self]))
 host = property(lambda self:";".join([_.host for _ in self]))
 db = property(lambda self:";".join([_.name for _ in self]))
 fix = property(lambda self:";".join([_.fix or "" for _ in self]))

Detailed Description

Represents a cascade of databases (a list of :class:`DBCon` instances)
created from a :class:`DybPython.dbconf.DBConf` instance

Definition at line 200 of file dbcas.py.


Constructor & Destructor Documentation

def DybPython::dbcas::DBCas::__init__ (   self,
  cnf,
  append = True 
)

Definition at line 205 of file dbcas.py.

00206                                            :
00207         self.cnf = cnf
00208         if not(append):return
00209         urls = cnf.urls
00210         users = cnf.users
00211         pswds = cnf.pswds
00212         fixs = cnf.fixs 
00213         for i,url in enumerate(urls):
00214             user = i >= len(users) and users[0] or users[i]
00215             pswd = i >= len(pswds) and pswds[0] or pswds[i]
00216             fix =  i < len(fixs) and fixs[i] or None
00217             self.append( DBCon( url, user, pswd, fix=fix ) ) 


Member Function Documentation

def DybPython::dbcas::DBCas::dump (   self,
  dir = None,
  opt = "" 
)

Definition at line 225 of file dbcas.py.

00226                                       :
00227         if dir and not os.path.exists(dir):
00228             os.mkdir(dir)
00229         for i,c in enumerate(self):
00230             name = "%s.sql" % i
00231             path = dir and os.path.join( dir, name ) or name  
00232             c.dump( path , opt )

def DybPython::dbcas::DBCas::Dump (   cls,
  dir = ".",
  opt = " --extended-insert=0 --skip-comments ",
  cfdir = None,
  reference = False 
)

Definition at line 233 of file dbcas.py.

00234                                                                                                      :
00235         from DybPython import DBConf
00236         cnf = DBConf.from_env()
00237         cas = DBCas(cnf)
00238         dir  = os.path.expandvars(dir)   
00239         if not os.path.exists(dir):
00240             os.makedirs(dir)
00241         print "DBCas.Dump into %s " % dir
00242         cas.dump( dir=dir, opt=opt  ) 
00243         if cfdir or reference:
00244             DD.Compare( cas, dir, cfdir, reference )    

def DybPython::dbcas::DBCas::spawn (   self)
Spawning a cascade creates the databases in the cascade with prefixed names
and populates them with fixtures 

Definition at line 247 of file dbcas.py.

00248                    :
00249         """
00250         Spawning a cascade creates the databases in the cascade with prefixed names
00251         and populates them with fixtures 
00252         """
00253         cas = DBCas(self.cnf, append=False)
00254         for _ in self: 
00255             cas.append(_.spawn(fixpass=self.cnf.fixpass))
00256         return cas
00257 
00258 


Member Data Documentation

tuple DybPython::dbcas::DBCas::Dump = classmethod(Dump) [static]

Definition at line 245 of file dbcas.py.

Definition at line 205 of file dbcas.py.


Property Documentation

DybPython::dbcas::DBCas::url = property(lambda self:";".join([_.url for _ in self])) [static]

Definition at line 218 of file dbcas.py.

DybPython::dbcas::DBCas::user = property(lambda self:";".join([_.user for _ in self])) [static]

Definition at line 219 of file dbcas.py.

DybPython::dbcas::DBCas::pswd = property(lambda self:";".join([_.pswd for _ in self])) [static]

Definition at line 220 of file dbcas.py.

DybPython::dbcas::DBCas::host = property(lambda self:";".join([_.host for _ in self])) [static]

Definition at line 221 of file dbcas.py.

DybPython::dbcas::DBCas::db = property(lambda self:";".join([_.name for _ in self])) [static]

Definition at line 222 of file dbcas.py.

DybPython::dbcas::DBCas::fix = property(lambda self:";".join([_.fix or "" for _ in self])) [static]

Definition at line 223 of file dbcas.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:40 for DybPython by doxygen 1.7.4