scraperwiki.sql.execute

Here are the examples of the python api scraperwiki.sql.execute taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: scraperwiki-python
Source File: tests.py
View license
    def test_one_question_mark_with_nonlist(self):
        scraperwiki.sql.execute(u'CREATE TABLE zhuozi\xaa (\xaa TEXT);')
        scraperwiki.sql.execute(u'INSERT INTO zhuozi\xaa VALUES (?)', u'apple\xff')
        observed = scraperwiki.sql.select(u'* FROM zhuozi\xaa')
        self.assertListEqual(observed, [{u'\xaa': u'apple\xff'}])
        scraperwiki.sql.execute(u'DROP TABLE zhuozi\xaa')

Example 2

Project: scraperwiki-python
Source File: tests.py
View license
    def test_one_question_mark_with_list(self):
        scraperwiki.sql.execute(u'CREATE TABLE zhuozi\xaa (\xaa TEXT);')
        scraperwiki.sql.execute(u'INSERT INTO zhuozi\xaa VALUES (?)', [u'apple\xff'])
        observed = scraperwiki.sql.select(u'* FROM zhuozi\xaa')
        self.assertListEqual(observed, [{u'\xaa': u'apple\xff'}])
        scraperwiki.sql.execute(u'DROP TABLE zhuozi\xaa')

Example 3

Project: scraperwiki-python
Source File: tests.py
View license
    def test_multiple_question_marks(self):
        scraperwiki.sql.execute('CREATE TABLE zhuozi (a TEXT, b TEXT);')
        scraperwiki.sql.execute(
            'INSERT INTO zhuozi VALUES (?, ?)', ['apple', 'banana'])
        observed = scraperwiki.sql.select('* FROM zhuozi')
        self.assertListEqual(observed, [{'a': 'apple', 'b': 'banana'}])
        scraperwiki.sql.execute('DROP TABLE zhuozi')