コード例 #1
0
def test():
    # import journal
    # journal.debug("postgres.init").active = True
    # journal.debug("postgres.execute").active = True
    # journal.debug("postgres.connection").active = True

    # access the postgres package
    import pyre.db

    # build a database component
    db = pyre.db.postgres()
    # connect to the default database
    db.attach()

    # and return the component
    return db
コード例 #2
0
def test():
    # access the package
    import pyre.db

    # build a database component
    db = pyre.db.postgres()
    # verify it is going to attach to the default database that is guaranteed to exist
    assert db.database == "postgres"
    # attach
    db.attach()

    # create the pyre database
    db.dropDatabase(name="pyre")

    # and return the component
    return db
コード例 #3
0
def test():
    # access the package
    import pyre.db

    # build a database component
    db = pyre.db.postgres()
    # verify it is going to attach to the default database that is guaranteed to exist
    assert db.database == "postgres"
    # attach
    db.attach()

    # create the pyre database
    db.createDatabase(name="pyre")

    # and return the component
    return db
コード例 #4
0
    def create(self, plexus, **kwds):
        """
        Create my database
        """
        # get the name of my database
        name = plexus.layout.project
        # tell me
        plexus.info.log('creating database {!r}'.format(name))

        # get the low level package
        import pyre.db
        # build a database component
        db = pyre.db.postgres()
        # verify it is going to attach to the default database that is guaranteed to exist
        assert db.database == "postgres"
        # attach
        db.attach()
        # create the pyre database
        db.createDatabase(name=name)

        # all done
        return 0