Connect to Database#

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

Connect to a SQL Database System#

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

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

Note

Go over the CREATE DATABASE statement for more details. The Databases page lists all the database systems that EvaDB currently supports.

  1. Preview the Available Data Using SELECT

You can now preview the available data in the restaurant_reviews database with a standard SELECT statement.

cursor.query("""
   SELECT *
   FROM restaurant_reviews.food_review;
   """).df()
  1. Run Native Queries in the Connected Database With USE

You can also run native queries directly in the connected database system by the USE statement.

cursor.query(
   """
     USE restaurant_reviews {
             INSERT INTO food_review (name, review)
             VALUES (
               'Customer 1',
               'I ordered fried rice but it is too salty.'
             )
     };
   """).df()

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 LOAD statement.

cursor.query("""
   LOAD IMAGE 'reddit-images/*.jpg'
   INTO reddit_dataset;
""").df()
  1. Load Video from Cloud Bucket

You can load a video from an S3 cloud bucket into EvaDB using the LOAD statement.

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

Note

Go over the LOAD statement statement for more details on the types of unstructured data that EvaDB supports.