INNER CODE UNIT · Python

dot_csv

probcomp/bayeslite · shell/src/core.py:434

    def dot_csv(self, line):
        '''create table from CSV file
        <table> </path/to/data.csv>

        Create a SQL table named <table> from the data in
        </path/to/data.csv>.
        '''
        # XXX Lousy, lousy tokenizer.
        tokens = line.split()
        if len(tokens) != 2:
            self.stdout.write('Usage: .csv <table> </path/to/data.csv>\n')
            return
        table = tokens[0]
        pathname = tokens[1]
        try:
            with open(pathname, 'rU') as f:
                bayeslite.bayesdb_read_csv(self._bdb, table, f, header=True,
                                           create=True, ifnotexists=False)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…