Skip to content

Commit d42b534

Browse files
authored
Merge pull request #75 from oslabs-beta/master
Merge oslabs-beta master to open-source-labs master
2 parents 7015f79 + 0ff6ca9 commit d42b534

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2218
-226
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ dvdrental.tar
99
*.sql
1010
debug.log
1111
coverage/
12-
release-builds/
12+
release-builds/
13+
UserTableLayouts.json

Diff for: README.md

+27-17
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
<img src="./assets/readmeImages/logo_readme.png" height=300/>
44

55
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/oslabs-beta/SeeQR)
6-
![Release: 6.0.1](https://img.shields.io/badge/Release-6.0.1-red)
6+
![Release: 7.0.1](https://img.shields.io/badge/Release-7.0.0-red)
77
![License: MIT](https://img.shields.io/badge/License-MIT-orange.svg)
88
![Contributions Welcome](https://img.shields.io/badge/Contributions-welcome-blue.svg)
99
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2Ftheseeqr)](https://twitter.com/theseeqr)
1010
[![Github stars](https://img.shields.io/github/stars/open-source-labs/SeeQR?style=social)](https://github.com/open-source-labs/SeeQR)
11-
[![Tests](https://github.com/open-source-labs/SeeQR/actions/workflows/test.yml/badge.svg)](https://github.com/open-source-labs/SeeQR/actions/workflows/test.yml)
1211

1312
[SeeQR.info](http://www.seeqr.info)
1413

15-
<p><b>SeeQR: </b>A database analytic tool to compare the efficiency of different schemas and queries on a granular level so that developers/architects can make better informed architectural decisions regarding SQL databases at various scales.</p>
14+
<p>SeeQR is a <b>convenient one-stop shop</b> for efficient SQL database manipulation and performance testing. SeeQR can be used throughout the database life-cycle, from creation to testing.</p>
1615

1716
</div>
1817

@@ -33,6 +32,15 @@ To get started on contributing to this project:
3332
1. Download and install [Postgres.app](https://postgresapp.com/)(Mac)/[PGAdmin](https://www.pgadmin.org/download)(Windows) and start it before opening up SeeQR
3433
2. Ensure that psql is available in the `$PATH`
3534
3. Ensure that a 'postgres' role exists
35+
- Open a database in Postgres
36+
- Use command:
37+
- `SET ROLE postgres`
38+
4. Ensure that your Postgres instance is running on port 5432
39+
- If there is currently an instance running on port 5432
40+
- Open a new terminal
41+
- Use command to end all:
42+
- `sudo pkill -u postgres`
43+
- Start Postgres instance on port 5432
3644
4. Download the latest version of [SeeQR](https://github.com/open-source-labs/seeqr/releases/latest)
3745

3846
## Built With
@@ -60,23 +68,24 @@ To get started on contributing to this project:
6068
- Copying an existing database (with or without original data)
6169
- Users can export any database onto their local machine
6270
- Users can toggle between the 'DATABASES' view and the 'QUERIES' view
71+
- Users can toggle between an 'ER DIAGRAM' view and the 'TABLES' view for each database
6372

6473
<div align="center">
6574
<img src="./assets/readmeImages/gifs/quick_start.gif" width=800/>
6675
</div>
6776

6877
- Databases
69-
70-
- In the 'DATABASES' view, users can select a table from a list of all the tables in the schema of the currently selected database
71-
- Information about the selected table is then displayed
72-
- The name and size of the selected database are also displayed at the top of the page
73-
- Users can also generate large amounts of foreign-key compliant dummy data for the selected table in the current database. Currently supported data types are:
74-
- INT
75-
- SMALLINT
76-
- BIGINT
77-
- VARCHAR
78-
- BOOLEAN
79-
- DATE
78+
- In the 'DATABASES' view, an interactive Entity Relationship Diagram (`ER DIAGRAM`) is displayed for the selected database
79+
- Users can select `TABLE` to see selected database in tabular form
80+
- Users can select a table from a list of all the tables in the schema of the currently selected database
81+
- Information about the selected table is then displayed
82+
- The name and size of the selected database are also displayed at the top of the page
83+
- Users can also generate large amounts of foreign-key compliant dummy data for the selected table in the current database. Currently supported data types are:
84+
- INT
85+
- BIGINT
86+
- VARCHAR
87+
- BOOLEAN
88+
- DATE
8089

8190
<br>
8291
<div align="center">
@@ -86,14 +95,15 @@ To get started on contributing to this project:
8695

8796
- Users can create a new database from scratch by clicking the `Create New Database` button at the bottom of the sidebar
8897
- Once a the database is given a name, hitting the `Initialize Database` button will create new database on the users PostgreSQL instance
89-
- Users can then input SQL commands and click `Update Database` to create and drop tables in the database
90-
- Users have the option to alter any existing databases as well by selecting the database on the sidebar and running any SQL commands they would like.
98+
- Users can modify the newly created database as well as any existing databases using the `ER Diagram` to create/change/delete tables and columns
99+
- Users also have the option to alter any newly created / existing databases by inputting SQL commands and click `Update Database`
91100
- The `Export` button will write a .sql file on the user's desktop of the selected database
92101

93102

94103
<br>
95104
<div align="center">
96105
<img src="./assets/readmeImages/gifs/create_db.gif" width=800/>
106+
<img src="./assets/readmeImages/gifs/modify_db.gif" width=800/>
97107
</div>
98108
- Queries
99109

@@ -164,7 +174,7 @@ We've released SeeQR because it's a useful tool to help optimize SQL databases.
164174

165175
## Core Team
166176

167-
[Allison Le](https://github.com/allisonle1) | [Brandon Lee](https://github.com/BrandonW-Lee) | [Casey Escovedo](https://github.com/caseyescovedo) | [Casey Walker](https://github.com/cwalker3011) | [Catherine Chiu](https://github.com/catherinechiu) | [Chris Akinrinade](https://github.com/chrisakinrinade) | [Cindy Chau](https://github.com/cindychau) | [Claudio Santos](https://github.com/Claudiohbsantos) | [Eric Han](https://github.com/ericJH92) | [Faraz Akhtar](https://github.com/faraza22) | [Frank Norton](https://github.com/FrankNorton32) | [Harrison Nam](https://github.com/harrynam07) | [James Kolotouros](https://github.com/dkolotouros) | [Jennifer Courtner](https://github.com/jcourtner) | [John Wagner](https://github.com/jwagner988) | [Justin Dury-Agri](https://github.com/justinD-A) | [Justin Hicks](https://github.com/JuiceBawks) | [Katie Klochan](https://github.com/kklochan) | [May Wirapa Boonyasurat](https://github.com/mimiwrp) | [Mercer Stronck](https://github.com/mercerstronck) | [Muhammad Trad](https://github.com/muhammadtrad) | [Richard Guo](https://github.com/richardguoo) | [Richard Lam](https://github.com/rlam108) | [Sam Frakes](https://github.com/frakes413) | [Serena Kuo](https://github.com/serenackuo) | [Timothy Sin](https://github.com/timothysin) | [Vincent Trang](https://github.com/vincentt114)
177+
[Michelle Chang](https://github.com/mkchang168) | [Jake Bradbeer](https://github.com/JBradbeer) | [Bryan Santos](https://github.com/santosb93) | [William Trey Lewis](https://github.com/treyfrog128) | [Brandon Lee](https://github.com/BrandonW-Lee) | [Casey Escovedo](https://github.com/caseyescovedo) | [Casey Walker](https://github.com/cwalker3011) | [Catherine Chiu](https://github.com/catherinechiu) | [Chris Akinrinade](https://github.com/chrisakinrinade) | [Cindy Chau](https://github.com/cindychau) | [Claudio Santos](https://github.com/Claudiohbsantos) | [Eric Han](https://github.com/ericJH92) | [Faraz Akhtar](https://github.com/faraza22) | [Frank Norton](https://github.com/FrankNorton32) | [Harrison Nam](https://github.com/harrynam07) | [James Kolotouros](https://github.com/dkolotouros) | [Jennifer Courtner](https://github.com/jcourtner) | [John Wagner](https://github.com/jwagner988) | [Justin Dury-Agri](https://github.com/justinD-A) | [Justin Hicks](https://github.com/JuiceBawks) | [Katie Klochan](https://github.com/kklochan) | [May Wirapa Boonyasurat](https://github.com/mimiwrp) | [Mercer Stronck](https://github.com/mercerstronck) | [Muhammad Trad](https://github.com/muhammadtrad) | [Richard Guo](https://github.com/richardguoo) | [Richard Lam](https://github.com/rlam108) | [Sam Frakes](https://github.com/frakes413) | [Serena Kuo](https://github.com/serenackuo) | [Timothy Sin](https://github.com/timothysin) | [Vincent Trang](https://github.com/vincentt114)
168178

169179

170180
## License

Diff for: assets/readmeImages/gifs/Query_Execution.gif

836 KB
Loading

Diff for: assets/readmeImages/gifs/create_db.gif

1.72 MB
Loading

Diff for: assets/readmeImages/gifs/dummy_data.gif

658 KB
Loading

Diff for: assets/readmeImages/gifs/modify_db.gif

1.57 MB
Loading

Diff for: assets/readmeImages/gifs/quick_start.gif

2.63 MB
Loading

Diff for: backend/BE_types.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/**
22
* This file contains common types that need to be used across the backend
33
*/
4+
import {
5+
UpdatesObjType
6+
} from '../frontend/types';
47

58
export interface ColumnObj {
69
column_name: string;
@@ -28,3 +31,8 @@ export interface DBList {
2831
}
2932

3033
export type DummyRecords = [string[], ...Array<(string | number)[]>];
34+
35+
export type BackendObjType = {
36+
database: string;
37+
updates: UpdatesObjType;
38+
};

Diff for: backend/DummyD/dummyDataMain.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ type GenerateDummyData = (tableInfo: ColumnObj[], numRows: number) => Promise<Du
7171
const generateDummyData: GenerateDummyData = async (tableInfo: ColumnObj[], numRows: number) => {
7272
// assuming primary key is serial, get all the column names except for the column with the primary key
7373
const columnNames = tableInfo.reduce((acc: string[], curr: ColumnObj) => {
74-
if (curr.constraint_type !== 'PRIMARY KEY') acc.push(curr.column_name);
74+
// if (curr.constraint_type !== 'PRIMARY KEY')
75+
acc.push(curr.column_name);
7576
return acc;
7677
}, []);
7778
const dummyRecords: DummyRecords = [columnNames];
@@ -83,8 +84,8 @@ const generateDummyData: GenerateDummyData = async (tableInfo: ColumnObj[], numR
8384
for (let j = 0; j < tableInfo.length; j += 1) {
8485
// if column has no foreign key constraint, then generate dummy data based on data type
8586
if (
86-
tableInfo[j].constraint_type !== 'FOREIGN KEY' &&
87-
tableInfo[j].constraint_type !== 'PRIMARY KEY'
87+
tableInfo[j].constraint_type !== 'FOREIGN KEY'
88+
// && tableInfo[j].constraint_type !== 'PRIMARY KEY'
8889
) row.push(generateDataByType(tableInfo[j]));
8990

9091
// if there is a foreign key constraint, grab random key from foreign table
@@ -94,11 +95,15 @@ const generateDummyData: GenerateDummyData = async (tableInfo: ColumnObj[], numR
9495
const foreignTable = tableInfo[j].foreign_table;
9596
const getForeignKeyQuery = `
9697
SELECT ${foreignColumn}
97-
FROM ${foreignTable} TABLESAMPLE BERNOULLI(50)
98+
FROM ${foreignTable} TABLESAMPLE BERNOULLI(100)
9899
LIMIT 1
99100
`;
100101
const foreignKey = await db.query(getForeignKeyQuery);
101-
if (foreignKey.rows.length) row.push(foreignKey.rows[0]['_id']);
102+
const chosenPrimaryValue = foreignKey.rows[0][Object.keys(foreignKey.rows[0])[0]]
103+
if (foreignKey.rows.length) {
104+
if (typeof chosenPrimaryValue === 'string') row.push(`'${chosenPrimaryValue}'`);
105+
else row.push(chosenPrimaryValue);
106+
}
102107
else return new Error('There was an error while retrieving a valid foreign key.');
103108
} catch(err) {
104109
return err;

0 commit comments

Comments
 (0)