STILTS-SQLUPDATE(1)

πŸ‘‘ STILTS-SQLUPDATE β€” bestie, it's the <pink>stilts sqlupdate` era πŸ’…

okay so real talk, this is stilts-sqlupdate, and it Updates values in an SQL table. that's the whole vibe. it lives in the stilts family of commands, and we're gonna walk through it together, no cap. ✨


🌸 SYNOPSIS 🌸

no thoughts, just the ✨ invocation ✨:

stilts sqlupdate [db=<jdbc-url>] [user=<value>] [password=<value>]
                 [select=<select-stmt>] [assign=<col>=<expr>]
                 [progress=true|false]

πŸ¦‹ DESCRIPTION πŸ¦‹

so sqlupdate goes into an existing table in an SQL database and rewrites values in it. which rows get touched? you tell it with a normal SELECT statement, handed over via the select parameter. and then every column you want to change, plus the value you want to slam into it, gets given with the assign parameter. it's giving surgical. πŸŽ€

now, bestie, you might be asking: why not just use the database's own UPDATE statement? and honestly? in most cases, that would be a much better idea. periodt. BUT β€” with sqlupdate you get to write those values using STILTS's expression language, so you can flex all its various functions without having to embed them into the database itself. and the juicy part: SQL column names can be used as variables in those expressions, in exactly the same way that table column names are used as variables in other commands like tpipe. iykyk. πŸ’–

⚠️ caveat time, bestie: this command can only be used if you have access to an SQL database via JDBC. the details of how to configure a JDBC connection to a database are discussed in SUN/256 β€” and obviously you'll need a database to connect to, appropriate write permissions on it, and the relevant drivers. all three. no skipping. 😭

also real talk: this is a somewhat specialised command, and several things can go wrong with it, and those things are database/driver-specific. if you don't have a fairly good understanding of the database you're using it with, you may run into problems. that said β€” if you didn't have the permissions to do the updates, you'd be unlikely to be here in the first place, so. πŸ’€


πŸ’… OPTIONS πŸ’…

one bullet per option, let's go, we're not skipping a single one, not today:

  • db=<jdbc-url> β€” the URL that defines a connection to a database. it's shaped like jdbc:<subprotocol>:<subname>, and the details are database- and driver-dependent, so don't come for me about specifics. consult Sun's JDBC documentation plus the docs for the particular JDBC driver you're using. heads up: the relevant driver class also needs to be on your classpath and referenced in the jdbc.drivers system property for the connection to actually be made. all the pieces, bestie. 🧩
  • user=<value> β€” the user name for logging in to the SQL database. defaults to the current username, cute and convenient. ✨
  • password=<value> β€” the password for logging in to the SQL database. no default. it's giving mystery. πŸ™ˆ
  • select=<select-stmt> β€” hands over the full text (yes, including the word "SELECT") of the SELECT statement that identifies which rows undergo updates. full text. did i stutter. πŸ‘‘
  • assign=<col>=<expr> β€” assigns new values for a given column. the assignment comes in the form <colname>=<expr>, where <colname> is the name of a column in the SQL table and <expr> is the text of an expression using STILTS's expression language, as described in SUN/256. SQL table column names or $ID identifiers may be used as variables in the usual way. 🌈

this parameter can be supplied more than once to effect multiple assignments β€” or you can do multiple assignments by separating them with semicolons in the value of this parameter. your call, both slay.

  • progress=true|false β€” if true, a spinner gets drawn on standard error showing how many rows have been updated so far. little spinning friend. mesmerizing. πŸŒ€

🫢 SEE ALSO 🫢

if the package stilts-doc is installed, the full documentation SUN/256 is available in HTML format at:

file:///usr/share/doc/stilts/sun256/index.html

⭐ VERSION ⭐

STILTS version 3.5.4-debian

this is the Debian version of Stilts, which lack the support of some file formats and network protocols. for differences see:

file:///usr/share/doc/stilts/README.Debian

πŸ’œ AUTHOR πŸ’œ

Mark Taylor (Bristol University) β€” legend behaviour, fr fr.


and that's the whole page, bestie!! this doc dropped way back in Mar 2017 and it's still out here doing its thing for STILTS-SQLUPDATE(1) in the Stilts commands manual. go update some tables responsibly, mwah πŸ’‹πŸŒΈ

πŸ“¦ where this page comes from