Skip to content

Instantly share code, notes, and snippets.

@mindsdbadmin
Last active March 23, 2021 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindsdbadmin/3269e9e72eb3dea03b458e11300dc808 to your computer and use it in GitHub Desktop.
Save mindsdbadmin/3269e9e72eb3dea03b458e11300dc808 to your computer and use it in GitHub Desktop.
# Importing in memory SQL engine as mdsql
# in the next couple of days you will import as follows
# - import modin.experimental.sql as mdsql
# For now you can pip install the sql engine 'pip install pdsql' and include it as follows:
from dfsql import sql_query
import modin.sql as mdsql
mdsql.query = sql_query
# You can then define the query that you want to perform
sql_str = "SELECT App,Category,Rating FROM gstore_apps WHERE Price = '0'"
# And simply apply that query to a dataframe
result_df = mdsql.query(sql_str, gstore_apps=gstore_apps_df)
# Or, in this case, where the query only requires one table,
# you can also ignore the FROM part in the query string:
query_str = "SELECT App, Category, Rating WHERE Price = '0' "
# mdsql.query can take query strings without FROM statement
# you can specify from as the function argument
result_df = mdsql.query(query_str, from=gstore_apps_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment