yanniskatsaros / faro

An SQL-focused data analysis library for Python.
MIT License
6 stars 5 forks source link

Add `from_sqlite` #7

Closed alxwrd closed 5 years ago

alxwrd commented 5 years ago

hi @yanniskatsaros! happy hacktoberfest 🎃

This addresses #3.

I've added connection as a new kwarg on the Database object, and used this to add a .from_sqlite() method that does some shuffling to get the name from the file name.

Database("my_database", connection="my_database.db")

Database.from_sqlite("my_database.db")

The only thing I'm not sure about is with this implementation it leaves the database on disk. It doesn't create a new db in memory and copy the data across.

With faro you can use pure SQL to work with a collection of table objects in memory

Should this apply for this use case as well? If so, I think it will tie in with #5.

yanniskatsaros commented 5 years ago

Hi @alxwrd and thanks for contributing!

All changes look good to me. I do realize the description says "... work with a collection of table objects in memory" but that might be a bit misleading. The main goal is to provide a simpler interface for working with tabular data using SQL directly in Python. Whether the database itself exists in memory or on disk is probably dependent on the situation.

This implementation is also helpful because you can "restore a previous session" much easier if it's saved on disk. All looks good - merging this.

alxwrd commented 5 years ago

@yanniskatsaros ok, good to know!