def from_database(cls, filename: str, completed_only: bool = False) -> "Aggregator": """ Create an instance from a sqlite database file. If no file exists then one is created with the schema of the database. Parameters ---------- completed_only filename The name of the database file. Returns ------- An aggregator connected to the database specified by the file. """ from autofit.database import open_database session = open_database(str(filename)) aggregator = Aggregator(session, filename) if completed_only: return aggregator(aggregator.search.is_complete) return aggregator
def test_create(): m.open_database("test.sqlite") assert os.path.exists(output_path)
def test_create_postgres(): try: m.open_database("postgresql://*****:*****@localhost/autofit") except Exception as e: logging.exception(e) assert not os.path.exists(output_path)
def test_make_dirs(): m.open_database(f"a/long/path.sqlite")