Skip to content
XAI-liacsPublic

About

A prototype for experimenting with storing BLADE data in Postgres database.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Blade Database HTTP

  • This is a web interface with blade database project that translates the postgresql commands to http commands for easy use as the backend in the BladeDB.

Database architecture:

Database

Setting Up PostgreSQL:

  • Run the following command:
    • macOS:
          psql postgres
    • Linux:
          sudo -u postgres psql
  • Create a new database in posgres client represented by:
        postgres=#
    • To create a new database use command:
        CREATE DATABASE blade;
    • Then connect to the new database:
          \c blade
      • This will update the cli prompt to:
            blade=#
    • Linux only Set the user password:
          ALTER USER postgres PASSWORD 'postgres';
  • Get your connection string of the format:
        protocol://<username>:<password>@host:port/database
    
    • Let's call this access_key.
    • Test it using psql, example:
          psql "postgres://username:password@localhost:5432/blade"
      • It will open a postgres client with blade db active. Exit using \q command.

Building / Destroying the database.

  • For managing the schema of the database, we are using goose:

  • Use command:

      $: go install github.com/pressly/goose/v3/cmd/goose@latest
  • Once installed, there are schema management files available in directory /sql/schema, when in that directory use command:

      $: goose postgres "<access_key>" up

    to build the database in the PostgreSQL, and:

      $: goose postgres "<access_key>" down

    to undo the build.

Safe Data Injection.

  • For implementing data injection into database, with proper input cleaning, we are using SQLC.
  • Install it using:
      go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

About

A prototype for experimenting with storing BLADE data in Postgres database.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages