vmware-archive / sql-to-dbsp-compiler

Compiler translating SQL view definitions into DBSP circuits (https://github.com/vmware/database-stream-processor)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get table and view names + types

gz opened this issue · comments

Given a SQL query

CREATE TABLE demographics (
    cc_num FLOAT64 NOT NULL,
);

CREATE TABLE transactions (
    trans_date_trans_time TIMESTAMP,
);

CREATE VIEW transactions_with_demographics as 
    SELECT
        transactions.cc_num,
    FROM
     ...

I'd like to get the following info in JSON: table names & type, view names, view type. e.g., something like that (actual schema is open to discussion):

{
  tables: [ {name: 'demographics', fields: [ { name: 'cc_num', type: 'float64', attributes: ['not null', 'unique'] }, ... ], ... }
  views: [ {name: 'transactions_with_demographics', fields: [{name: 'cc_num', type: float64, attributes: []}, ...]}, ...]
}