def test_empty_with_query(self):
        input_file = six.StringIO()

        with stdin_as_string(input_file):
            output_file = six.StringIO()
            utility = CSVSQL(['--query', 'select 1'], output_file)
            utility.run()
            output_file.close()

        input_file.close()
Exemplo n.º 2
0
    def test_empty_with_query(self):
        input_file = six.StringIO()

        with stdin_as_string(input_file):
            output_file = six.StringIO()
            utility = CSVSQL(['--query', 'select 1'], output_file)
            utility.run()
            output_file.close()

        input_file.close()
Exemplo n.º 3
0
    def csvsql(self, csv_file, db=None):
        """
        Load test data into the DB and return it as a string for comparison.
        """
        if not db:
            db = 'sqlite:///' + self.db_file

        args = ['--db', db, '--table', 'foo', '--insert', csv_file]

        utility = CSVSQL(args)
        utility.run()

        with open(csv_file, 'r') as f:
            return f.read().strip()
    def csvsql(self, csv_file, db=None):
        """
        Load test data into the DB and return it as a string for comparison.
        """
        if not db:
            db = 'sqlite:///' + self.db_file

        args = ['--db', db, '--tables', 'foo', '--insert', csv_file]

        utility = CSVSQL(args)
        utility.run()

        with open(csv_file, 'r') as f:
            text = f.read()

        return text.strip()