0
Corrigé

Reverse Engineering from SQL file option not working as expected

shradha il y a 4 ans mis à jour par Rafał Strzaliński (Senior Engineer) il y a 4 ans 3

I have tried to create a vertabelo model using the "From Sql" file option , but for few tables it doesn't create all the columns.

I checked the sql file and the create table statement has all the columns

JE SUIS SATISFAIT
Note de satisfaction par shradha il y a 4 ans
À l'étude

Hi,


Could you provides us sample SQL that won't work?

CREATE TABLE cntct_addr_history
(
 addr_id BIGINT IDENTITY(1000, 1) NOT NULL,
 mdm_cntct_id VARCHAR(100) NOT NULL,
 addr_typ_txt VARCHAR(200),
 addr_class_txt VARCHAR(200),
 addr_ln1_txt VARCHAR(240),
 addr_ln2_txt VARCHAR(240),
 addr_ln3_txt VARCHAR(240),
 addr_twn_city_txt VARCHAR(240),
 addr_po_box_txt VARCHAR(150),
 addr_pstcd_zip_cd VARCHAR(150),
 addr_st_txt VARCHAR(50),
 addr_cntry_txt VARCHAR(50),
 tm_zn_txt VARCHAR(200),
 addr_not_vld_ind CHAR(1),
 insrt_ts TIMESTAMP DEFAULT ('now'::character varying)::timestamp without time zone,
 insrt_by VARCHAR(20),
 updt_ts TIMESTAMP,
 updt_by VARCHAR(20),
 addr_cnty_txt VARCHAR(50),
 mdm_addr_key VARCHAR(100),
 stg_addr_id INTEGER,
 src_crt_dt_tm TIMESTAMP,
 src_last_mod_dt_tm TIMESTAMP,
 addr_cat_cd VARCHAR(200)
)
DISTSTYLE EVEN
SORTKEY
(
 mdm_cntct_id
);


The above is the sample sql from the import.SQL file and it has just created the table cntct_addr_history with only one column { addr_id BIGINT } within vertabelo's data model

Corrigé

Hi,


There is a problem with "IDENTITY(1000, 1)" declaration in the first column. This is not valid PostgreSQL column spec, but Redshift extension. If you remove this declaration, you'll be able to import table.

https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html

https://www.postgresql.org/docs/9.6/static/sql-createtable.html