| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

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 url = property(lambda self:";".join([_.url for _ in self]))
tuple user = property(lambda self:";".join([_.user for _ in self]))
tuple pswd = property(lambda self:";".join([_.pswd for _ in self]))
tuple host = property(lambda self:";".join([_.host for _ in self]))
tuple db = property(lambda self:";".join([_.name for _ in self]))
tuple Dump = classmethod(Dump)

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.


Member Function Documentation

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

Definition at line 202 of file dbcas.py.

00202                                                  :class:`DBCon` instances)
00203     created from a :class:`DybPython.dbconf.DBConf` instance
00204     """
00205     def __init__( self, cnf , append=True ):
00206         self.cnf = cnf
00207         if not(append):return
00208         urls = cnf.urls
00209         users = cnf.users
00210         pswds = cnf.pswds
00211         fixs = cnf.fixs 
00212         for i,url in enumerate(urls):
00213             user = i >= len(users) and users[0] or users[i]
00214             pswd = i >= len(pswds) and pswds[0] or pswds[i]

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

Definition at line 221 of file dbcas.py.

00221                                :";".join([_.host for _ in self]))
00222     db   = property(lambda self:";".join([_.name for _ in self]))
00223 
00224     def dump(self, dir=None , opt="" ):
00225         if dir and not os.path.exists(dir):
00226             os.mkdir(dir)
00227         for i,c in enumerate(self):
00228             name = "%s.sql" % i

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

Definition at line 229 of file dbcas.py.

00232                                                                                                      :
00233         from DybPython import DBConf
00234         cnf = DBConf.from_env()
00235         cas = DBCas(cnf)
00236         dir  = os.path.expandvars(dir)   
00237         if not os.path.exists(dir):
00238             os.makedirs(dir)
00239         print "DBCas.Dump into %s " % dir
00240         cas.dump( dir=dir, opt=opt  ) 
        if cfdir or 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 243 of file dbcas.py.

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


Member Data Documentation

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

Definition at line 215 of file dbcas.py.

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

Definition at line 216 of file dbcas.py.

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

Definition at line 217 of file dbcas.py.

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

Definition at line 218 of file dbcas.py.

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

Definition at line 219 of file dbcas.py.

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

Definition at line 241 of file dbcas.py.

DybPython::dbcas::DBCas::cnf

Definition at line 203 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 Mon Apr 11 20:13:02 2011 for DybPython by doxygen 1.4.7