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

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



Hi Pete,

> metadata=> select * from grid_info limit 10;
> id | datasetid | ensembleid | secondaryid | level_id | location_id | 
> parameter_abbreviation
> ----+------------------+------------+-------------+----------+-------------+------------------------
> 1 | FE_GFS_Globalp25 | | | 44 | 30 | Vis
> 2 | FE_GFS_Globalp25 | | | 407 | 30 | uW
> 3 | FE_GFS_Globalp25 | | | 474 | 30 | REFD
> 4 | FE_GFS_Globalp25 | | | 1 | 30 | REFC
> 5 | FE_GFS_Globalp25 | | | 45 | 30 | PMSL
> 6 | FE_GFS_Globalp25 | | | 407 | 30 | vW
> 7 | FE_GFS_Globalp25 | | | 551 | 30 | PVV
> 8 | FE_GFS_Globalp25 | | | 407 | 30 | VRATE
> 9 | FE_GFS_Globalp25 | | | 44 | 30 | WGS
> 10 | FE_GFS_Globalp25 | | | 474 | 30 | SNMR
> (10 rows)

So, this above output is showing the column names in order (id, datasetid, 
ensembledid, etc) and then
10 records with their respective information (some of the columns may be null, 
as shown in this output).

> metadata=> delete from grid_info where id=FE_GFS_Globalp25;

The command you tried to run was saying delete the record where the id equals 
"FE_GFS_Globalp25", but
the id column consists solely of numbers (listed 1-10 in the output you showed 
above).  I want to 
clarify quickly, this is not all the data that's in your table.

Are you trying to remove quarter degree GFS data?  Because that's what your 
delete command was attempting
to do.
There are likely thousands of rows in this table.
You can see exactly how many rows with this command:
select count(*) from grid_info;
 
If you spend a little time googling around "psql select statements" you might 
be able to better narrow
down exactly the records you're looking for.

You only got 10 results because the command I first gave you limited it to 10 
results ('limit 10').
One that might be useful is to grab all the unique values of the datasetid (in 
this case the first 10
entries are all the GFS Global .25 data.

I think this should give you all the unique values of datasetid:
select distinct datasetid from grid_info;

This should list all the datasetids and hopefully the one you want to remove 
(conusarw) shows up as one 
of those ids?

Then you'd need to either actually use the integer values of the ids and delete 
based on id, or you
could do a string matching based delete, which I believe would be

delete from grid_info where datasetid ilike '[enter dataset id]';

*note there would be no square [] brackets, I'm just using that to note where 
to put the name

So if you did want to delete all GFS quarter degree you'd do
delete from grid_info where datasetid ilike 'FE_GFS_Globalp25';

Granted, doing it this way doesn't allow you to keep track of the info table's 
id value, which would be
used to delete the corresponding records from the grid table.  But honestly, 
like I said previously, I 
think that data will be purged anyway and probably isn't a huge waste of 
resources.

Let me know if this is making more sense?

--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.