https://github.com/jordan-m-young/rscodb
Relational Database Implementation
https://github.com/jordan-m-young/rscodb
database from-scratch postgres rust sql
Last synced: 22 days ago
JSON representation
Relational Database Implementation
- Host: GitHub
- URL: https://github.com/jordan-m-young/rscodb
- Owner: Jordan-M-Young
- License: apache-2.0
- Created: 2024-03-25T14:42:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-28T02:55:44.000Z (about 2 years ago)
- Last Synced: 2025-02-12T05:15:34.475Z (over 1 year ago)
- Topics: database, from-scratch, postgres, rust, sql
- Language: Rust
- Homepage:
- Size: 38.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# rscoDB
 
This is a from scratch implementation of a Relational Database in rust. The goal here is for myself and perhaps others
to more deeply understand the inner workings of popular relational database systems like postgres by attempting to build
an analog system. Some things this project will focus on are:
- SQL Syntax
- Supporting Basic Statements/Logic (SELECT, INSERT, CREATE, FROM, etc...)
- Validating command syntax
- Command Plans
- SQL syntax -> Plan structs containing information required to programmatically execute command
- Plan validation
- DataStorage
- In memory -> Single File (Sqlite) -> PG_DATA directory (Postgres)
- ACID
- External Client
- Support external client access
- Write basic python client
## Current Focus
Currently I'm focusing on finishing up sine basic SQL syntax and accompanying logic. You can see what SQL statements are supported currently. At this time input commmands are very lightly validated, so further work will be required for a more robust validation system.
## Run
```bash
cargo run
```
# SQL
For rscoDB, we'll try to mirror the SQL syntax used by [Postgres](https://www.postgresql.org/docs/current/sql-syntax.html).
## Supported Commands
### Database
#### Create Database
```sql
CREATE DATABASE my_database
```
#### Connect to Database
```sql
CONNECT database_name
```
#### Show Databases
```sql
SHOW DATABASE
```
#### Drop Database
```sql
DROP DATABASE db_name
```
### Table
#### Create Table
```sql
CREATE TABLE table_name (field_a int, field_b varchar)
```
#### Show Database Tables
```sql
SHOW TABLE
```
#### Drop Database Table
```sql
DROP TABLE table_name
```
### Inserting Rows
```sql
INSERT INTO table_name VALUES (1, hello, 3.0)
```
### Querying
#### The only query right now lol
```sql
SELECT * FROM table_name
```