
    create table PYTHONPERFORMANCE (
        [UUID] uniqueidentifier not null,
        [TIMESTAMP] float,
        [USER] varchar(20),
        [CREATION_DATE] datetime2,
        [TITLE] varchar(80),
        [TOTAL_CALLS] numeric(10,0),
        [PRIMITIVE_CALLS] numeric(10,0),
        [TOTAL_TIME] float
    );

    IF NOT EXISTS (SELECT * FROM SYS.INDEXES
       WHERE IS_PRIMARY_KEY = 1 AND OBJECT_ID IN
             (SELECT OBJECT_ID FROM SYS.TABLES WHERE NAME = 'PYTHONPERFORMANCE'))
       alter table PYTHONPERFORMANCE add constraint PID351DT351 primary key ([UUID]);

    alter table PYTHONPERFORMANCE 
        add constraint DT351UUID_DEFAULT DEFAULT newid() FOR [UUID];

    alter table PYTHONPERFORMANCE 
        add constraint DT351UUID_NOT_NULL check([UUID] is not null);

    alter table PYTHONPERFORMANCE 
        add constraint DT351DI064011_DEFAULT DEFAULT 0 FOR [TIMESTAMP];

    alter table PYTHONPERFORMANCE 
        add constraint DT351DI064012_DEFAULT DEFAULT CONVERT(datetime2,'01.01.1970',104) FOR [CREATION_DATE];

    alter table PYTHONPERFORMANCE 
        add constraint DT351DI064025_DEFAULT DEFAULT 0 FOR [TOTAL_CALLS];

    alter table PYTHONPERFORMANCE 
        add constraint DT351DI064026_DEFAULT DEFAULT 0 FOR [PRIMITIVE_CALLS];

    alter table PYTHONPERFORMANCE 
        add constraint DT351DI064027_DEFAULT DEFAULT 0 FOR [TOTAL_TIME];

    create table PYTHONFUNCTIONCALL (
        [UUID] uniqueidentifier not null,
        [PYTHON_PROFILING] uniqueidentifier,
        [CALLED_ROW] uniqueidentifier,
        [FILENAME] varchar(100),
        [LINENO] numeric(10,0),
        [FUNCTION] varchar(100),
        [PRIMITIVE_CALLS] numeric(10,0),
        [NUMBER_OF_CALLS] numeric(10,0),
        [TOTAL_TIME] float,
        [CUMULATIVE_TIME] float
    );

    IF NOT EXISTS (SELECT * FROM SYS.INDEXES
       WHERE IS_PRIMARY_KEY = 1 AND OBJECT_ID IN
             (SELECT OBJECT_ID FROM SYS.TABLES WHERE NAME = 'PYTHONFUNCTIONCALL'))
       alter table PYTHONFUNCTIONCALL add constraint PID352DT352 primary key ([UUID]);

    alter table PYTHONFUNCTIONCALL with nocheck  
        add constraint FKPYTHONFUNCTIONCALLID351 
        foreign key ([PYTHON_PROFILING]) 
        references PYTHONPERFORMANCE        
        on delete no action;
    CREATE TRIGGER UFKPYTHONFUNCTIONCALLID351 ON PYTHONPERFORMANCE
        FOR DELETE
        AS
        BEGIN
            DELETE t
            FROM DELETED d
                INNER JOIN PYTHONFUNCTIONCALL t ON d.UUID = t.PYTHON_PROFILING
        END;
    alter table PYTHONFUNCTIONCALL with check check constraint FKPYTHONFUNCTIONCALLID351;

    create index IDX_PYTHONFUNCTIONCALLID351 on PYTHONFUNCTIONCALL ([PYTHON_PROFILING]);

    create index IDX_PYTHONFUNCTIONCALLID352S on PYTHONFUNCTIONCALL ([CALLED_ROW]);

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352UUID_DEFAULT DEFAULT newid() FOR [UUID];

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352UUID_NOT_NULL check([UUID] is not null);

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352PYTHON_PROFILING_NOT_NULL check([PYTHON_PROFILING] is not null);

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352DI064019_DEFAULT DEFAULT 0 FOR [LINENO];

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352DI064020_DEFAULT DEFAULT 0 FOR [PRIMITIVE_CALLS];

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352DI064021_DEFAULT DEFAULT 0 FOR [NUMBER_OF_CALLS];

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352DI064022_DEFAULT DEFAULT 0 FOR [TOTAL_TIME];

    alter table PYTHONFUNCTIONCALL 
        add constraint DT352DI064023_DEFAULT DEFAULT 0 FOR [CUMULATIVE_TIME];
