duartealexf / sql-ddl-to-json-schema

SQL DDL to JSON Schema Converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interestedin postgresql transformer

aminechouicha opened this issue · comments

Hi.
I am interested to contribute for postgresql. Any pointer how to go about. Thank you.

Hi @aminechouicha thank you for taking interest! 💯 🥇

Some first steps:

Most of the work is comprised of:

  • Converting PostgreSQL syntax boards into Nearley language. For example, see this synopsis section of the ALTER TABLE statement – you'll be writing a Nearley version of it... probably breaking it down into:
    • alter table definition
    • alter table: action (for the part where it says "where action is one of" in the synopsis)
    • partition_bound_spec
    • column_constraint
    • table_constraint
    • table_constraint_using_index
    • ...etc

This project supports parsing most DDL statements for a given language, so if it parses CREATE TABLE then later ALTER TABLE, the output respects the table alterations made to the created table... so some post-parsing specific logic is required – for example, see what adding a primary key does to the table in MySQL: here and here.

Let me know if there's anything else. Closing this for now.