[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AWIPS #YED-418649]: CAVE Product Browser - grid data linventory



Hey Pete,

> Yeah this makes more sense. And the names in datasetid match perfectly the 
> data dirs in
> hdf5 and what one sees in the product browser. But notice the error below 
> about "foreign
> key constraint" -- should I be performing these commands as root?
>
> metadata=> select distinct datasetid from grid_info;
> datasetid
> ----------------------------
> FE_EMCHRRR_US3km
> FE_GFS_Globalp25
> FE_CONUSARW_US5km
> FE_HWFV3_US5km
> FE_ECMWF-EnsMean_Globalp40
> FE_NAEFS-BC_Globalp50
> FE_RCMC_10km
> FE_CONUSMEM2_US5km
> FE_GCMC_Globalp15
> FE_UKMET_Global1p25
> FE_NAM_3km
> FE_ECMWF_Globalp40
> FE_WRFNSSL_US3km
> FE_NAM_12km
> (14 rows)

> metadata=> delete from grid_info where datasetid ilike 'FE_GFS_Globalp25';
> ERROR: update or delete on table "grid_info" violates foreign key constraint 
> "fk_qbwxtbi5dn61tnsm55soxkhxh" on table "grid"
> DETAIL: Key (id)=(1) is still referenced from table "grid".

Okay, cool, now we're getting somewhere.
One more time to clarify though, are you trying to remove GFS global quarter 
degree? (Because
that's what the delete command attempted to do).

I thought you wanted to remove "FE_CONUSARW_US5km" based on the output from the 
above query 
and your initial message?

The foreign key constraint just means we have to remove the related grid table 
entries first, 
which isn't a huge deal.
So what you'll want to do is see how many records there are for the CONUSARW 
dataset (assuming
that's the one you really want to remove?)

select * from grid_info where datasetid ilike 'fe_conusarw_us5km';

**note: the 'ilike' command is case insensitive (hence the preceding 'i') so 
that's why the above
command should work

Hopefully this returns some kind of manageable result?  ie. less than 20 or so 
records.

Then, from that response, you see what the id is for each matching record (the 
value in the first
column), then you take that id number and remove it from the grid table:

delete from grid where info_id=x;

(and x is the matching 'id' value from the previous select statement)

Once you remove all matching values in the grid table, then you should be able 
to run:

delete from grid_info where datasetid ilike 'fe_conusarw_us5km';

Does that make sense?

(And I didn't directly answer before, but no, you don't run as root)

Let me know if that helps?
--Shay Carter

She/Her/Hers
AWIPS Software Engineer
UCAR - Unidata

If you're interested, please feel free to fill out a survey about the support 
you receive: 
https://docs.google.com/forms/d/e/1FAIpQLSeDIkdk8qUMgq8ZdM4jhP-ubJPUOr-mJMQgxInwoAWoV5QcOw/viewform

Ticket Details
===================
Ticket ID: YED-418649
Department: Support AWIPS
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.