DEV Community

Rstar1998
Rstar1998

Posted on

Xata SQL over HTTP

Xata is a serverless database that integrates analytics and free-text search. Xata offers a unique architecture which couples a postgres with elasticsearch. This architecture helps Xata offer database along with powerful search as a service. Xata also adds other awesome features like storing file attachments, Ask AI , Vector embedding etc on top of it.

Architecture

You can create a free database on Xata. Check out here. You can use this for conducting POC's for your project.


Lets import a sample CSV file

Go to "Import CSV File"

Dashboard

Select any CSV file from your Desktop. Confirm details and start your import.

Once your file is successfully imported than you will see something like this

Import CSV

By default Xata will add 4 columns to your table along with the CSV data.

default columns

id: unique identifier
xata.createdAt : timestamp of when the record was inserted
xata.updatedAt : timestamp of when the record was modified
xata.version : The number of changes that were done to that row.

You can go to Playground and run some PostgreSQL queries on the table.

Playground


You can also write REST API's to query your tables on Xata

Write a REST API using the follwing format

curl --location 'https://{workspace}.{region}.xata.sh/db/{db}:{branch}/sql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_KEY>' \
--data '{
  "statement": "SELECT * FROM \"StudentsPerformance\""
}'
Enter fullscreen mode Exit fullscreen mode

Output of Rest API

Postman

Top comments (0)