Esempio n. 1
0
 def count(self, selection=None, **kwargs):
     keys, cmps = parse_selection(selection, **kwargs)
     sql, args = self.create_select_statement(keys, cmps, what='COUNT(*)')
     con = self._connect()
     self._initialize(con)
     cur = con.cursor()
     cur.execute(sql, args)
     return cur.fetchone()[0]
Esempio n. 2
0
    def count(self, selection=None, **kwargs):
        keys, cmps = parse_selection(selection, **kwargs)
        sql, args = self.create_select_statement(keys, cmps, what='COUNT(*)')

        with self.managed_connection() as con:
            cur = con.cursor()
            cur.execute(sql, args)
            return cur.fetchone()[0]
Esempio n. 3
0
def main(args):
    query = parse_selection(args.query)
    include = args.include.split(',') if args.include else []
    exclude = args.exclude.split(',') if args.exclude else []

    for path in allpaths(args.folder, include, exclude):
        format, row = check(path, query, args.verbose)
        if format:
            if args.long:
                print('{} {:10} {:15} {}'.format(
                    ''.join(str(p) for p in row.pbc.astype(int)), row.formula,
                    format, path))
            else:
                print(path)