MCPcopy Index your code
hub / github.com/wireservice/csvkit / csvsql

Method csvsql

tests/test_utilities/test_sql2csv.py:34–49  ·  view source on GitHub ↗

Load test data into the DB and return it as a string for comparison.

(self, csv_file, db=None)

Source from the content-addressed store, hash-verified

32 pass
33
34 def csvsql(self, csv_file, db=None):
35 """
36 Load test data into the DB and return it as a string for comparison.
37 """
38 if not db:
39 db = 'sqlite:///' + self.db_file
40
41 args = ['--db', db, '--tables', 'foo', '--insert', csv_file, '--no-inference']
42
43 utility = CSVSQL(args)
44 utility.run()
45
46 with open(csv_file) as f:
47 text = f.read()
48
49 return text.strip()
50
51 def test_encoding(self):
52 # Test that csvstat doesn't error on Latin-1 input.

Callers 4

test_unicodeMethod · 0.95
test_no_header_rowMethod · 0.95
test_linenumbersMethod · 0.95

Calls 2

CSVSQLClass · 0.90
runMethod · 0.80

Tested by

no test coverage detected