https://github.com/neorandom/sql-pseudocode-transpiler
Transpile a custom SQL pseudocode into multiple things.
https://github.com/neorandom/sql-pseudocode-transpiler
json openpyxl pandas pandas-dataframe pandas-python pseudocode sql ssms
Last synced: 3 months ago
JSON representation
Transpile a custom SQL pseudocode into multiple things.
- Host: GitHub
- URL: https://github.com/neorandom/sql-pseudocode-transpiler
- Owner: neoRandom
- Created: 2024-11-05T05:45:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-14T04:13:03.000Z (about 1 year ago)
- Last Synced: 2025-03-06T05:32:23.209Z (10 months ago)
- Topics: json, openpyxl, pandas, pandas-dataframe, pandas-python, pseudocode, sql, ssms
- Language: Python
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pseudocode Translator
Made by myself to myself.
## How it works
The software receives a path to the pseudocode file, reads the file, parse it into JSON and then turns it into SSMS SQL code and an Excel Data Dictionary.
## Functionalities
- [x] Parse pseudocode into JSON
- [x] Generate SQL code
- [ ] Generate Data Dictionary
- [x] In .xlsx (Excel Spreadsheet)
- [ ] In .csv (Comma-Separated Values)
- [ ] In .ods (OpenDocument Spreadsheet)
- [ ] Generate ERD (Entity-Relationship Diagram)
- [ ] With just the entities
- [ ] With the complete SQL in a table format
## Pseudocode Structure
> If this is too hard to read, see the [example](#example) and the [notes and rules](#notes-and-rules) to learn how to use it.
```
{for each table in the database}
- {table name} {optional: {'// ' or '# ' + table notes}}
{optional: {'description: ' + table description }}
{for each attribute in the table}
- {name} {type}{optional: {'({size})'}} {constrains separated by spaces} {optional: {'// ' or '# ' + description}}
{end for}
{end for}
```
### Example
```
- user # Needs to have a special character in the name or the password
description: Stores the credentials of a user
- user_id PK
- name varchar(64)
- password varchar(256) // Needs to have at least 8 characters
- data // References the user table
description: Stores at maximum 1024 characters of whatever the user wants
- data_id PK
- user_id FK(user)
- content: varchar(1024) null
```
### Notes and Rules
- The Database name is the file name without extension (e.g.: `db.txt` database name is `db`).
- All the words, except description and notes, become lower cased when parsed.
- The `not null` constrain is replaced with `null`, to explicitly state that the attribute can be NULL.
- PKs and FKs are defined without type, but when parsed the type will be INT.
- FKs are defined with the "size" being the name of the referenced table.
## License
This project is currently not under any external [license](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository).