Perfect (and obvious now I see it). Thanks,
Martin On Thursday, 8 January 2015 11:55:26 UTC, Lvc@ wrote: > > Hi Martin, > To rename a field from A to B in class C: > > UPDATE C SET B = A > UPDATE C REMOVE A > > Lvc@ > > > On 8 January 2015 at 11:17, Martin Pengelly-Phillips <[email protected] > <javascript:>> wrote: > >> Hi Luca, >> >> Reported at https://github.com/orientechnologies/orientdb/issues/3350 >> (hope that's the right place). >> >> I'm new to OrientDB so could you expand on what the syntax is for the <some >> way to get value of otherField for matched instance> part? >> >> cheers, >> >> >> Martin >> >> On Thursday, 8 January 2015 10:07:41 UTC, Lvc@ wrote: >>> >>> Hi Martin, >>> Supporting a RENAME keyword is nice. Please could you open a new issue >>> for that? >>> >>> Now what you wrote works: >>> >>> UPDATE <class> SET <field>=<some way to get value of otherField for >>> matched instance> >>> UPDATE <class> REMOVE <otherField> >>> >>> Lvc@ >>> >>> >>> On 8 January 2015 at 10:57, Martin Pengelly-Phillips < >>> [email protected]> wrote: >>> >>>> Thanks Luca - that worked (I had to change "name" to "fieldName" >>>> though). >>>> >>>> On a related note; is there a more direct way to rename a field through >>>> SQL API (when no property exists)? >>>> >>>> I was thinking something like >>>> >>>> UPDATE <class> RENAME <field> <newFieldName> >>>> >>>> Or even (similar to the ETL flow) >>>> >>>> UPDATE <class> SET <field>=<some way to get value of otherField for >>>> matched instance> >>>> UPDATE <class> REMOVE <otherField> >>>> >>>> At present I did it by creating a property, altering the property name >>>> and then dropping the property, but that felt a little wrong. >>>> >>>> cheers, >>>> >>>> >>>> Martin >>>> >>>> >>>> On Wednesday, 7 January 2015 22:26:28 UTC, Lvc@ wrote: >>>>> >>>>> Hi Martin, >>>>> You can do 2 field: set and remove. Example to rename the field b -> a: >>>>> >>>>> { "field": { "name": "a": "expression": "b" } }, >>>>> { "field": { "name": "b": "operation": "remove" } } >>>>> >>>>> Lvc@ >>>>> >>>>> >>>>> Lvc@ >>>>> >>>>> >>>>> On 7 January 2015 at 18:58, Martin Pengelly-Phillips < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi there, >>>>>> >>>>>> Been looking at http://www.orientechnologies.c >>>>>> om/docs/last/orientdb-etl.wiki/Import-from-DBMS.html recently and >>>>>> wondered if it is possible to rename a field as part of the process? >>>>>> >>>>>> Tried using "select as" but it didn't make a difference to the >>>>>> resulting property name. >>>>>> >>>>>> { >>>>>> "extractor": { >>>>>> "jdbc": { >>>>>> ... >>>>>> "query": "SELECT taskid as id, parent_id FROM task" >>>>>> } >>>>>> }, >>>>>> "transformers": [ >>>>>> {"vertex": {"class": "Context"}}, >>>>>> { >>>>>> "edge": { >>>>>> "class": "parent", >>>>>> "joinFieldName": "parent_id", >>>>>> "lookup": "Context.id" >>>>>> } >>>>>> } >>>>>> ], >>>>>> ... >>>>>> } >>>>>> >>>>>> Perhaps there is a transformer that can be used? >>>>>> >>>>>> cheers, >>>>>> >>>>>> >>>>>> Martin >>>>>> >>>>>> -- >>>>>> >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "OrientDB" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "OrientDB" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
