Copy measurment to another DB with new measurment name

Hello
i need some help to copy some measurment from a DB into another DB and into a new measurment!

influxDB 1.8x

source would be
DB-Name db433Mhz
measurements average

neue DB
DB-Name spez_temp_day

into a new measurement temperatur
no measurements table there now

do the measurment need to me allready in the new DB?

how to do it without bracking something.

have a nice day
vinc

Hello @vinc,
You can follow this logic but instead of pushing to Influx again:

How to export to line protocol with 1.x:

^that’s for historical data, otherwise you can apply a continuous query and copy data to a new measurement in real time.

hello @Anaisdg
thanks for your feedback, i did not understand your information
but i found to copy the db itself and then deletet the measurment not needed
and renamed with into the measurment.
NOW
i also inject with node red into the DB this works
but in the old db it was below the avarage and new it is added to temp

select * from temperatur ORDER BY time DESC LIMIT 10
name: temperatur
time | average | temp


1624379668272757650 | | 20.43
1624379662286809291 | | 20.43
1624376664853949466 | 21.17
1624375464832759378 | 21.07
1624374264847409586 | 21.17

so now how to move the data from average into temp?

have a nice day
vinc

Hello @vinc,
You’ll have to export the data into a file and then rewrite it to a new measurement.

Hello @Anaisdg
it must be something else because

show MEASUREMENTS
name: measurements
name

Sonnenazimut
temperatur

i have only this two

select * from temperatur ORDER BY time DESC LIMIT 10
name: temperatur
time average temp


so would it be possible it was taged without i know it

Did you already set up a Continuous Query?

I don’t understand the difference between:

select * from temperatur ORDER BY time DESC LIMIT 10

name: temperatur
time average temp


and:

Hm, something didn’t come out as intended there - the email → forum interface
has obviously swallowed some of what I quoted. Try again…

Did you already set up a Continuous Query?

I don’t understand the difference between:

select * from temperatur ORDER BY time DESC LIMIT 10

name: temperatur
time average temp


and:

Okay, I’m going to try this once more.

Did you already set up a Continuous Query?

I don’t understand the difference between what you wrote at 19:10:39 CEST:

select * from temperatur ORDER BY time DESC LIMIT 10

name: temperatur
time average temp


and what you wrote previously at 18:51:30 CEST:

select * from temperatur ORDER BY time DESC LIMIT 10

name: temperatur
time | average | temp


1624379668272757650 | | 20.43
1624379662286809291 | | 20.43
1624376664853949466 | 21.17
1624375464832759378 | 21.07
1624374264847409586 | 21.17

What changed between the two times you ran that same query?

Antony.

Hi @vinc

The task itself can be really easy but I need some additional info.

  1. You see you are running InfluxDB 1.8x, do you want to keep the same version?
  2. Do you want to move the data on a different DB in the same server or on some other server?

Now I’ll assume you are trying to move data locally, so just from a DB on the server to another DB on the same server.
You just need to use the INTO clause, in the docs you will find several useful examples, even to move lots of data.

The query you need is as simple as

SELECT * 
INTO "__DestDDB__"."__DestRp__"."__DestMeasurementName__" 
FROM "__CurrentDB__"."__RP__"."__Measurement__" 
GROUP BY *

Note that the GROUP BY * at the end is extremely important as it will keep tags and fields as they are, without it all the data will be stored as fields.
If you have a lot of data you might want to filter the data and load them a week at a time (or whatever suits you)

In order to make it work, you just need:

  • create the destination DB
  • create the desired retention policy

the measurement will be created automatically when the data are written

maybe it helps with the printscreen
the measurment befor was called avarage!
i renamed it into temperature
and with the select * query in the picture i take it from the new masurment temperature
but it still keep somewhere avarag.
the temp is the input in the last houers!

i would like to move the number in avarag into temp

That’s not a measurement name, that’s a field name and is completely different.
you can’t rename fields, the process to “rename” them is to:

  1. Copy the data to a new measurement (a temporary one), using SELECT INTO (you also need to rename the field using an alias)
  2. Drop the original Measurement
  3. Copy the data from temp back to the desired one
  4. remove the temp measurement

which translates to something like this

SELECT average AS temp INTO tmpdata FROM temperature GROUP BY *
SELECT temp INTO tmpdata FROM temperature GROUP BY *

DROP MEASUREMENT temperature

SELECT temp INTO temperature FROM tmpdata GROUP BY *

DROP MEASUREMENT tmpdata

at first it did not work time/written both 0
then i check it i had a spelling error or just german
changed and it worked as you wrote
thank you very much
is this temp a tag?
or would it be better to have taged datas?

in the future i would like to count days above 20 25 or 30 degree and compare it with the past
i also would check at 06:00 if the last past 12h are below 20 degree this would be a tropical night, but this magic would then be in Grafan v8

have a nice day vinc

“temp” was a measurement, you can see it as the equivalent of a table if you are used to SQL databases.
That said, InfluxDB works in a very different way.

I suggest you have a good look at the docs, starting from here, most of the common needs have already been answered here on the forum, so you shouldn’t have problems when it comes to finding answers.

About your need to track days/hours, well it does not come out of the box at least using InfluxQL, you might have some more luck with Flux, but I’m not that knowledgeable in it.
Have a look around about days/hours once you get some solid bases about how the DB structure works and how it can be queried as that is actually the key to your needs

Have a nice day

Hello @Giovanni_Luisotto

i need your help again ;-(

how to move all the datas from average into temp_mix
and how to delete average colone at the end?

thanks for your help again.

have a nice day
vinc