1# -*- coding: utf-8 -*- 2"""squint: simple query interface for tabular data 3 4PYTEST_DONT_REWRITE 5""" 6from __future__ import absolute_import 7import sys as _sys 8 9 10# Check that `sqlite3` is available. Some non-standard builds 11# of Python do not include the full standard library (e.g., 12# Jython 2.7 and Jython 2.5). 13try: 14 import sqlite3 as _sqlite3 15except ImportError as err: 16 message = ( 17 'The standard library "sqlite3" package is missing ' 18 'from the current Python installation:\n\nPython {0}' 19 ).format(_sys.version) 20 raise ImportError(message) 21 22 23# Check that `sqlite3` is not too old. Some very old builds 24# of Python were compiled with versions of SQLite that are 25# incompatible with Squint (e.g., certain builds of Python 26# 3.1.4 and Python 2.6.6). 27if _sqlite3.sqlite_version_info < (3, 6, 8): 28 message = ( 29 'Squint requires SQLite 3.6.8 or newer but the current ' 30 'Python installation was built with an old version:\n\n' 31 'Python {0}\n\nBuilt with SQLite {1}' 32 ).format(_sys.version, _sqlite3.sqlite_version) 33 raise ImportError(message) 34 35 36############################################ 37# Import squint objects into main namespace. 38############################################ 39from .query import BaseElement 40from .select import Select 41from .select import Query 42from .result import Result 43from ._vendor.predicate import Predicate 44from . import _preview 45 46 47__version__ = '0.1.0' 48 49BaseElement.__module__ = 'squint' 50Select.__module__ = 'squint' 51Query.__module__ = 'squint' 52Result.__module__ = 'squint' 53Predicate.__module__ = 'squint' 54 55# Set display hook for interactive sessions. 56_sys.displayhook = _preview.displayhook 57