Example #1
0
 def test_pg_version_check(self):
     if not tests.is_datastore_supported():
         raise nose.SkipTest("Datastore not supported")
     engine = db._get_engine(
         {'connection_url': pylons.config['sqlalchemy.url']})
     connection = engine.connect()
     assert db._pg_version_is_at_least(connection, '8.0')
     assert not db._pg_version_is_at_least(connection, '10.0')
Example #2
0
 def test_pg_version_check(self):
     if not tests.is_datastore_supported():
         raise nose.SkipTest("Datastore not supported")
     engine = db._get_engine(None,
         {'connection_url': pylons.config['sqlalchemy.url']})
     connection = engine.connect()
     assert db._pg_version_is_at_least(connection, '8.0')
     assert not db._pg_version_is_at_least(connection, '10.0')
Example #3
0
def _is_legacy_mode(config):
    '''
        Decides if the DataStore should run on legacy mode

        Returns True if `ckan.datastore.read_url` is not set in the provided
        config object or CKAN is running on Postgres < 9.x
    '''
    engine = db.get_write_engine()
    connection = engine.connect()

    return (not config.get('ckan.datastore.read_url')
            or not db._pg_version_is_at_least(connection, '9.0'))
Example #4
0
def _is_legacy_mode(config):
    """
        Decides if the DataStore should run on legacy mode

        Returns True if `ckan.datastore.read_url` is not set in the provided
        config object or CKAN is running on Postgres < 9.x
    """
    write_url = config.get("ckan.datastore.write_url")

    engine = db._get_engine({"connection_url": write_url})
    connection = engine.connect()

    return not config.get("ckan.datastore.read_url") or not db._pg_version_is_at_least(connection, "9.0")
Example #5
0
def _is_legacy_mode(config):
    '''
        Decides if the DataStore should run on legacy mode

        Returns True if `ckan.datastore.read_url` is not set in the provided
        config object or CKAN is running on Postgres < 9.x
    '''
    write_url = config.get('ckan.datastore.write_url')

    engine = db._get_engine({'connection_url': write_url})
    connection = engine.connect()

    return (not config.get('ckan.datastore.read_url') or
            not db._pg_version_is_at_least(connection, '9.0'))