def as_join(self, reverse=False):
        """Return a string formatted as an SQL join expression."""
        tables = [self.reftable, self.table]
        if reverse:
            tables.reverse()
        tables = tuple(tables)
        joinstr = '%s inner join %s on ' % tables
        sep = ''
        for idx, col in enumerate(self.columns):
            joinstr += sep + '%s.%s = %s.%s' % (
                self.reftable, self.refcolumns[idx],
                self.table, col)
            sep = ' and '
        return joinstr
dataset/ETHPy150Open jaysw/ipydb/ipydb/metadata/model.py/ForeignKey.as_join/original