be4311c07e14feb728abc6425ee606ffaa611a58 markd Fri Jan 22 06:46:58 2021 -0800 merge with master diff --git src/hg/sqlUpdateRelated/sqlUpdateRelated.doc src/hg/sqlUpdateRelated/sqlUpdateRelated.doc index 37ba03cb..c3338f8 100644 --- src/hg/sqlUpdateRelated/sqlUpdateRelated.doc +++ src/hg/sqlUpdateRelated/sqlUpdateRelated.doc @@ -19,31 +19,31 @@ table shoe #id type_id name 1 2 soft soul sneakers 2 1 havaina luxury thongs 3 3 urban polish We'd like to be able to specify new data for these two related tables with something like: #type name sneakers soft sole sneakers sandles havaina luxury thongs loafers urban polish We'd like to do this, because hey, we aren't in the database, we don't know what all the id's are, -and also one table is easir to write than two. With sqlUpdateRelated it's not quite as simple, but not much harder. We just have to encode a little info about the foreign key relationship in the +and also one table is easier to write than two. With sqlUpdateRelated it's not quite as simple, but not much harder. We just have to encode a little info about the foreign key relationship in the field name, which we do with @ signs: #@type_id@shoe_types@value@id name sneakers soft sole sneakers sandles havaina luxury thongs loafers urban polish The foreign key field starts with a single @ sign so we know it's not a normal field. The remaining @ signs delimit the following parts of the extended field name: 1 - field name in the main table 2 - name of foreign table 3 - field to look up in the foreign table 4 - primary key (to output in main table in place of value in #3) in foreign table.