Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jarulraj committed Sep 1, 2023
1 parent 6cb8ebd commit 94e17a9
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 31 deletions.
89 changes: 61 additions & 28 deletions docs/source/overview/connect-to-database.rst
Original file line number Diff line number Diff line change
@@ -1,59 +1,92 @@
Connect to Database
============================

EvaDB supports an extensive data sources for both structured and unstructured data.
EvaDB supports an extensive range of data sources for structured and unstructured data.

1. Connect to an existing structured data source.
.. note::

Learn more about structured and unstructured data in :doc:`Data Sources <getting-started/data-sources>`.


Connect to a SQL Database System
--------------------------------

1. Use the `CREATE DATABASE` statement to connect to an existing SQL database.

.. code-block:: python
cursor.query("""
CREATE DATABASE postgres_data WITH ENGINE = 'postgres', PARAMETERS = {
"user": "eva",
"password": "password",
"host": "localhost",
"port": "5432",
"database": "evadb"
};""").df()
CREATE DATABASE restaurant_reviews
WITH ENGINE = 'postgres',
PARAMETERS = {
"user": "eva",
"password": "password",
"host": "localhost",
"port": "5432",
"database": "restaurant_reviews"
};""").df()
.. note::

Check :ref:`Create DATABASE statement<sql-create-database>` for syntax documentation and :ref:`Data Sources<data-sources>` for all supported data source engines.

The above query connects to an exsiting Postgres database, which allows us to build AI applications in EvaDB without data migration.
For example, the following query previews the available data using :ref:`SELECT<sql-select>`.
Go over the :ref:`CREATE DATABASE<sql-create-database>` statement for more details. The :ref:`Databases<databases>` page lists all the database systems that EvaDB currently supports.

.. code-block:: python
cursor.query("SELECT * FROM postgres_data.food_review;").df()
2. Preview the Available Data Using `SELECT`

We can also run native queries in the connected database by the :ref:`USE<sql-use>` statement.
You can now preview the available data in the `restaurant_reviews` database with a standard :ref:`SELECT<sql-select>` statement.

.. code-block:: python
cursor.query("""
USE postgres_data {
INSERT INTO food_review (name, review) VALUES ('Customer 1', 'I ordered fried rice but it is too salty.')
};""").df()
SELECT *
FROM restaurant_reviews.food_review;
""").df()
3. Run Native Queries in the Connected Database With `USE`

2. Load unstructured data. EvaDB supports a wide range of type of unstructured data. Below are some examples:
You can also run native queries directly in the connected database system by the :ref:`USE<sql-use>` statement.

.. code-block:: python
cursor.query(
"LOAD IMAGE 'reddit-images/*.jpg' INTO reddit_dataset;"
).df()
"""
USE restaurant_reviews {
INSERT INTO food_review (name, review)
VALUES (
'Customer 1',
'I ordered fried rice but it is too salty.'
)
};
""").df()
We load the local reddit image dataset into EvaDB.
Load Unstructured Data
-----------------------

EvaDB supports diverse types of unstructured data. Here are some examples:

1. Load Images from Local Filesystem

You can load a collection of images obtained from Reddit from the local filesystem into EvaDB using the :ref:`LOAD<sql-load>` statement.

.. code-block:: python
cursor.query("""
LOAD IMAGE 'reddit-images/*.jpg'
INTO reddit_dataset;
""").df()
cursor.query("LOAD VIDEO 's3://bucket/eva_videos/mnist.mp4' INTO MNISTVid;").df()
2. Load Video from Cloud Bucket

We load the MNIST video from s3 bucket into EvaDB.
You can load a video from an S3 cloud bucket into EvaDB using the :ref:`LOAD<sql-load>` statement.

.. code-block:: python
cursor.query("""
LOAD VIDEO 's3://bucket/eva_videos/mnist.mp4'
INTO MNISTVid;
""").df()
.. note::

Check :ref:`LOAD statement<sql-load>` for all types of supported unstructured data.
Go over the :ref:`LOAD statement<sql-load>` statement for more details on the types of unstructured data that EvaDB supports.

2 changes: 1 addition & 1 deletion docs/source/overview/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ You should see a list of built-in functions including but not limited to the fol
.. note::
EvaDB supports additional installation options for extending its functionality. Go over the :doc:`Additional Installation Options <getting-started/additional-installation-options>` for all the available options.
EvaDB supports additional installation options for extending its functionality. Go over the :doc:`Installation Options <getting-started/installation-options>` for all the available options.
Illustrative AI App
-------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/reference/databases/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _data-sources:
.. _databases:

Data Sources
Databases
=============

Below are all supported data sources for EvaDB. We welcome adding new data source integrations in EvaDB. Check :ref:`add-data-source` for guidance.
Expand Down

0 comments on commit 94e17a9

Please sign in to comment.