Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

initial data connectors #82

wants to merge 11 commits into from

Conversation

StanChan03
Copy link
Collaborator

Initial SQL Integration

@StanChan03 StanChan03 requested a review from sidjha1 January 15, 2025 04:08
@StanChan03 StanChan03 linked an issue Jan 16, 2025 that may be closed by this pull request
class DatabaseConnector:
def __init__(self):
self.sql_engine = None
self.nosql_client = None
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree


connector = DatabaseConnector()
connector.connect_sql("sqlite:///example_movies.db")
lotus_db = LotusDB(connector)
Copy link
Collaborator

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?

Copy link
Collaborator

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")

Copy link
Collaborator Author

@StanChan03 StanChan03 Jan 18, 2025

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

Copy link
Collaborator Author

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?

Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@StanChan03 StanChan03 changed the title initial sql integration initial data connectors Jan 20, 2025
@StanChan03 StanChan03 requested a review from liana313 January 25, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for SQL and NoSQL databases.
2 participants