How to use the quandl.model.database.Database function in Quandl

To help you get started, we’ve selected a few Quandl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quandl / quandl-python / test / test_database.py View on Github external
def test_database_returns_database_object(self):
        database = Database('NSE')
        self.assertIsInstance(database, Database)
        self.assertEqual(database.database_code, 'NSE')
github quandl / quandl-python / test / test_database.py View on Github external
def test_database_calls_connection(self, mock):
        database = Database('NSE')
        database.data_fields()
        expected = call('get', 'databases/NSE', params={})
        self.assertEqual(mock.call_args, expected)
github quandl / quandl-python / test / test_database.py View on Github external
def setUp(self):
        httpretty.enable()
        httpretty.register_uri(httpretty.GET,
                               re.compile(
                                   'https://www.quandl.com/api/v3/databases/*'),
                               adding_headers={
                                   'Location': 'https://www.blah.com/download/db.zip'
                               },
                               body='{}', status=302)
        httpretty.register_uri(httpretty.GET,
                               re.compile('https://www.blah.com/'), body='{}')

        database = {'database': DatabaseFactory.build(database_code='NSE')}
        self.database = Database(database['database']['database_code'], database['database'])
        ApiConfig.api_key = 'api_token'
        ApiConfig.api_version = '2015-04-09'
github quandl / quandl-python / test / test_database.py View on Github external
def test_databases_returns_database_objects(self):
        results = Database.all()
        self.assertEqual(len(results), 10)
        for result in results:
            self.assertIsInstance(result, Database)
github quandl / quandl-python / test / test_dataset.py View on Github external
def test_dataset_database_gives_instance_of_database(self):
        database = self.dataset_instance.database()
        self.assertIsInstance(database, Database)
github quandl / quandl-python / test / test_database.py View on Github external
def setUpClass(cls):
        httpretty.enable()
        database = {'database': DatabaseFactory.build(database_code='NSE')}
        httpretty.register_uri(httpretty.GET,
                               re.compile(
                                   'https://www.quandl.com/api/v3/databases/*'),
                               body=json.dumps(database))
        cls.db_instance = Database(Database.get_code_from_meta(
            database['database']), database['database'])
github quandl / quandl-python / test / test_database.py View on Github external
def test_databases_returns_database_objects(self):
        results = Database.all()
        self.assertEqual(len(results), 10)
        for result in results:
            self.assertIsInstance(result, Database)
github quandl / quandl-python / quandl / model / dataset.py View on Github external
def database(self):
        return quandl.model.database.Database(self.database_code)