May this question is silly, but i am not able to generate the regex expression to fetch table Name and PRIMARY KEY.
TABLE:
CREATE TABLE 'dhcpr_dhcprelayinterface' (
'vrId' integer default 0,
'ifName' string ,
PRIMARY KEY(ifName,vrId),
FOREIGN KEY (vrId) REFERENCES 'vr_vr'(vrId) ON DELETE CASCADE ON UPDATE CASCADE);
I am using:
begin = re.compile(r"CREATE TABLE[ \"]*([^ \"]+)[ \"]*[(]([^/;]+)[/;]",re.IGNORECASE)
to fetch all table name and data.
But i would need data only with table name and PRIMARY KEY.
Expected Output:
dhcpr_dhcprelayinterface
PRIMARY KEY(ifName,vrId)