DROP SERIES with tag key - influxdb

I am using version 1.2.1-c1.2.2 shell version
I wish to drop all series in my database where the tag value is not null.
https://docs.influxdata.com/influxdb/v1.3/query_language/database_management/#drop-series-from-the-index-with-drop-series
I ran the following query but kept getting the same error. How can I drop series using the where clause?
drop series from "measurement" where "tag" != ''
drop series from "measurement" where "tag" != 'abcd'
I got the following error
ERR: partial success, node 4 may be down (error code 1: fields not supported in WHERE clause during deletion)
How can I drop series using the WHERE clause on a key_value?

Related

Link Sheets and Query with timestamps

I'm trying to link a custom query, but since i'm new in this, i'm getting stuck when Sheets tries to read timestamps
I'm getting the following error:
Something's wrong. Please try again later: Error while parsing the query: Syntax error: Table name contains '-' character. It needs to be quoted: 'xxxxxxxxxx' [at 3:10]
SELECT COUNT(DISTINCT sequence) as aaaaaaaa,bbbbbbb,
EXTRACT (date from CreationDateBR) as data,
FROM xxxxxxxxxxxx
WHERE CreationDateBR BETWEEN '2021-01-01' AND '2022-01-01'
AND loja IN ('Marketplace C')
AND parceiros NOT IN ('partner A')
GROUP BY parceiros,data
ORDER BY data,parceiros asc
The error message states that the issue is in the table name. You can try to put backticks around it (`):
FROM `xxxxxxxxxxxx`
A good trick to ensure the proper formatting is to go to your table in the BigQuery UI and click on "query this table": the proper formatting will open in a new query editor.

Influxdb query on tag returns nothing

I have an Influxdb with lots of fields and a single tag:
> show tag keys
name: rtl433
tagKey
------
model
Now, I want a list of all possible values for model, so I run
SELECT model FROM rtl433
>
-and it returns nothing. Why? There's lots of data in model if I select *.
You are trying to use classic SQL solution, but InfluxDB is not classic SQL DB. You should check InfluxDB doc and you will find solution:
SHOW TAG VALUES WITH KEY = "model"

ERROR: column "engagements.id" must appear in the GROUP BY clause or be used in an aggregate function

i have the following query which works
#engagements = Engagement.includes(:participation).where(influencer_authorization_id: current_influencer.id).group_by { |p| p.status }
i am trying to use the Database function instead of the Ruby/Rails function to group and the following is my code
engagements = Engagement.where(influencer_authorization_id: current_influencer.id).group("status")
But i am getting the following error
ERROR: column "engagements.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "engagements".* FROM "engagements" WHERE "engagements...
^
Update
I tried doing the following but still doesnt work
engagements = Engagement.select("engagements.*").where(influencer_authorization_id: current_influencer.id).group("engagement.status")
ERROR
ERROR: missing FROM-clause entry for table "engagement"
LINE 1: ...ents"."influencer_authorization_id" = $1 GROUP BY engagement...
^
Do you use postgres?
The problem is that database can't decide what to show for e.g. 'id' column when 'status' is the same for several records. You can manually write select statement and use aggregate functions.
I think this PostgreSQL -must appear in the GROUP BY clause or be used in an aggregate function and this GroupingError: ERROR: column must appear in the GROUP BY clause or be used in an aggregate function are related

Rails PostgreSQL problems with order statement

Hi
I changed my database from mySql to PostgreSQL and get an error every time I use query with :order statement
For example the following code works perfectly in MySQL
Hour.sum("working_hours",:conditions=>['project_id=? AND reported_date=?',project,h.reported_date],:order=>"reported_date
But gives me an error in PostgreSQL
PGError: ERROR: column "hours.reported_date" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...rted_date='2010-10-06 00:00:00.000000') ORDER BY reported_d..
: SELECT sum("hours".working_hours) AS sum_working_hours FROM "hours" WHERE (project_id=1 AND reported_date='2010-10-06 00:00:00.000000') ORDER BY reported_date
If I delete the order statement then the query works ok
I will most appreciate any help on this subject
PostreSQL is stricter to the SQL standard than MySQL is.
SQL states that if you ORDER by a column, that column must be SELECTed and appear in the GROUP BY clause.
Try this:
Hour.sum("working_hours",:conditions=>['project_id=? AND reported_date=?',project,h.reported_date], :order=>"reported_date", :group_by => "working_hours"

Firebird Insert Distinct Data Using ZeosLib and Delphi

I'm using Zeos 7, and Delphi 2009 and want to check to see if a value is already in the database under a specific field before I post the data to the database.
Example: Field Keyword
Values of Cheese, Mouse, Trap
tblkeywordKEYWORD.Value = Cheese
What is wrong with the following? And is there a better way?
zQueryKeyword.SQL.Add('IF NOT EXISTS(Select KEYWORD from KEYWORDLIST ='''+
tblkeywordKEYWORD.Value+''')INSERT into KEYWORDLIST(KEYWORD) VALUES ('''+
tblkeywordKEYWORD.Value+'''))');
zQueryKeyword.ExecSql;
I tried using the unique constraint in IBExpert, but it gives the following error:
Invalid insert or update value(s): object columns are
constrained - no 2 table rows can have duplicate column values.
attempt to store duplicate value (visible to active transactions) in unique index "UNQ1_KEYWORDLIST".
Consider to use UPDATE OR INSERT or MERGE statements:
update or insert into KEYWORDLIST (KEYWORD) values(:KEYWORD) matching(KEYWORD)
For details check the following documents in your Firebird installation folder:
doc\sql.extensions\README.update_or_insert.txt
doc\sql.extensions\README.merge.txt

Resources