In Druid, is it possible to do update datasource set metric1 = xxx, metric2 = yyy where dimension1 = zzz ? and how?
You can not insert based on a where clause that uses the dimension.
To overwrite the data you have 2 options:
First is to make the changes to the original raw data and then re-ingest all the data set.
Second option is to add a delta to the existing data source http://druid.io/docs/latest/ingestion/update-existing-data.html
Related
I want to update my geometry(point) column with latitude(float) and longitude(float) column.
Table PK column is pk.
I tried to query
update ucs.target1
set geo_point = st_geomfromtext('point(latitude longitude)')
where pk = 'gd'
but syntax error occured.
help me plz....
An alternative way, try this one by specifying the srid (in here for example for WGS84):
update ucs.target1
set geo_point = st_geomfromtext('point(longitude latitude)',4326)
where pk = 'gd'
I edit my answer here:
Suppose I have table with its structure :
CREATE TABLE schema.table_name
(
id integer NOT NULL,
geom_4326 geometry(Point,4326)
)
Table have already rows, and I want to update the coordinate at a specific id, in here id = 'id_value'.
My code is :
update schema.table_name
SET geo_point = ST_SetSRID(ST_MakePoint(longitude,latitude), SRID)
where id = 'id_value'
SRID in my case = 4326
I am trying to execute an SQLite query to update a column in my accounts table:
UPDATE account SET accrued = (account.accrued + ((product.intrate/365)*balance))
FROM account
JOIN customer ON customer.custid = account.custid
JOIN product ON product.prodid = account.prodid
WHERE active = 1
I have tried this, but it comes up with the result
ambiguous column name: account.accrued
UPDATE a SET accrued = (a.accrued + ((p.intrate/365)*balance))
FROM account a
JOIN customer c ON c.custid = a.custid
JOIN product p ON p.prodid = a.prodid
WHERE active = 1
I have also tried that query, but the result comes up with no such table a. If I take out the column accrued from the calculation I then get the same error for the balance column.
The column accrued is only in the one table, account.
This is the correct syntax for SQLite:
UPDATE account AS a
SET accrued = (a.accrued + ((p.intrate/365)*balance))
FROM customer c JOIN product p
ON p.prodid = a.prodid
WHERE c.custid = a.custid AND active = 1
Note that you should qualify all the column names (except the column that is updated after SET) with the table name/alias to avoid ambiguities.
I am just starting to work with openedge and I need to join information from two tables but I just need the first row from the second one.
Basically I need to do a typical SQL Cross Apply but in progress. I look in the documentation and the Statement FETCH FIRST 10 ROWS ONLY only in OpenEdge 11.
My query is:
SELECT * FROM la_of PUB.la_ofart ON la_of.empr_cod = la_ofart.empr_cod
AND la_of.Cod_Ordf = la_ofart.Cod_Ordf
AND la_of.Num_ordex = la_ofart.Num_ordex AND la_of.Num_partida = la_ofart.Num_partida
CROSS APPLY (
SELECT TOP 1 ofart.Cod_Ordf AS Cod_Ordf_ofart ,
ofart.Num_ordex AS Num_ordex_ofart
FROM la_ofart AS ofart
WHERE ofart.empr_cod = la_ofart.empr_cod
AND ofart.Num_partida = la_ofart.Num_partida
AND la_ofart.doc1_num = ofart.doc1_num
AND la_ofart.doc2_linha = ofart.doc2_linha
ORDER BY ofart.Cod_Ordf DESC) ofart
I am using SSMS to extract data from OE10 using an ODBC connector and querying to OE using OpenQuery.
Thanks for all help.
If I correctly understood your question, maybe you can use something like this. Maybe this isn't the best solution for your problem, but may suit your needs.
DEF BUFFER ofart FOR la_ofart.
DEF TEMP-TABLE tt-ofart NO-UNDO LIKE ofart
FIELD seq AS INT
INDEX ch-seq
seq.
DEF VAR i-count AS INT NO-UNDO.
EMPTY TEMP-TABLE tt-ofart.
blk:
FOR EACH la_ofart NO-LOCK,
EACH la_of NO-LOCK
WHERE la_of.empr_cod = la_ofart.empr_cod
AND la_of.Cod_Ordf = la_ofart.Cod_Ordf
AND la_of.Num_ordex = la_ofart.Num_ordex
AND la_of.Num_partida = la_ofart.Num_partida,
EACH ofart NO-LOCK
WHERE ofart.empr_cod = la_ofart.empr_cod
AND ofart.Num_partida = la_ofart.Num_partida
AND ofart.doc1_num = la_ofart.doc1_num
AND ofart.doc2_linha = la_ofart.doc2_linha
BREAK BY ofart.Cod_Ordf DESCENDING:
ASSIGN i-count = i-count + 1.
CREATE tt-ofart.
BUFFER-COPY ofart TO tt-ofart
ASSIGN ofart.seq = i-count.
IF i-count >= 10 THEN
LEAVE blk.
END.
FOR EACH tt-ofart USE-INDEX seq:
DISP tt-ofart WITH SCROLLABLE 1 COL 1 DOWN NO-ERROR.
END.
We're using telegraf to collect CloudWatch data from AWS and output it to InfluxDB.
We need to add dynamic tags to the input, s.t if "instancId == 12345", add tag "user = 3"
Is there a way to do this?
Take a look at the processors. If you have just a set of known values that you want to work with, I think enum would be the best option. Here is the example updated for your case:
[[processors.enum]]
[[processors.enum.mapping]]
## Name of the field to map
field = "instancId"
## Destination field to be used for the mapped value. By default the source
## field is used, overwriting the original value.
dest = "user"
## Default value to be used for all values not contained in the mapping
## table. When unset, the unmodified value for the field will be used if no
## match is found.
default = 0
## Table of mappings
[processors.enum.mapping.value_mappings]
123 = 1
1234 = 2
12345 = 3
See the CONFIGURATION.md docs:
[[inputs.cpu]]
percpu = false
totalcpu = true
[inputs.cpu.tags]
tag1 = "foo"
tag2 = "bar"
I would like to replace a value Test to Mess in Column A in a table T where the value is Var in Column B in the same table.
Please someone help me with the query as I'm new to Oracle.
This is very easy, try this:
UPDATE t
SET A = REPLACE(A, 'Test', 'Mess')
WHERE B = 'Var';
or if You want not replace, but full text update in A column, you can make like this :
UPDATE t
SET A = 'Mess'
WHERE B = 'Var' and A = 'Test';