-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial data connectors #82
base: main
Are you sure you want to change the base?
Conversation
lotus/databases/connectors.py
Outdated
class DatabaseConnector: | ||
def __init__(self): | ||
self.sql_engine = None | ||
self.nosql_client = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove all the nosql
stuff since there is not one interface for all the nosql offerings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
examples/db_examples/sql_db.py
Outdated
|
||
connector = DatabaseConnector() | ||
connector.connect_sql("sqlite:///example_movies.db") | ||
lotus_db = LotusDB(connector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need LotusDB
? Can't we just have a connect.load_as_pandas(table_name: str)
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe DatabaseConnector
just provides a staticmethod
@staticmethod
def load_from_db(connection_url: str, table_name: str) -> pd.DataFrame
And then all the code here becomes
df = DatabaseConnector.load_from_db("sqlite:///example_movies.db", "movies")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, what if someone has a specific query thats not just select * from table? Maybe have something like
def load_from_db(connection_url: str, query: str) -> pd.DataFrame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if someone has a very large dataset should we consider processing it in batches, and then concat them together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def load_from_db(connection_url: str, query: str) -> pd.DataFrame
This works
Also if someone has a very large dataset should we consider processing it in batches, and then concat them together?
If someone has a very large dataset then I think lotus
just will not be able to work, since the requirement is that it can be loaded into a pandas
dataframe in memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
0048eb1
to
badfdd5
Compare
Initial SQL Integration