Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String replacement in DB
#1
I have two SQLite3 databases each with one table:
Database: MyModule.db has a table "content"
CREATE TABLE "content" (
"topic_id" integer,
"data" BLOB,
"data2" blob,
PRIMARY KEY("topic_id")
);
The field data is in RTF format.

Database: Afr2020map.db has a table "repstr"
CREATE TABLE "repstr" (
"istr" TEXT,
"ostr" TEXT,
PRIMARY KEY("istr")
);

I need to run through all records in MyModule.db and in every record replace in "data" every occurrence of istr with ostr.

Attached is my code which does not work:

What am I doing wrong?
Yoriz write Dec-28-2022, 08:30 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up Use generator with sring replacement... [solved] SpongeB0B 9 2,379 Oct-10-2025, 06:43 AM
Last Post: Pedroski55
  If I need to do regex replacement 27000 times, how to shorten it? tatahuft 4 1,547 Dec-26-2024, 01:51 AM
Last Post: deanhystad
  replacement for fpformat.extract GbSig1998 4 2,022 Apr-12-2024, 06:15 PM
Last Post: deanhystad
Exclamation IndexError: Replacement index 2 out of range for positional args tuple - help? MrKnd94 2 16,795 Oct-14-2022, 09:57 PM
Last Post: MrKnd94
  Extract the largest value from a group without replacement (beginner) preliator 1 3,125 Aug-12-2020, 01:56 PM
Last Post: DPaul
  Simple automated SoapAPI Call with single variable replacement from csv asaxty 1 3,374 Jun-30-2020, 06:38 PM
Last Post: asaxty
  line replacement help mdalireza 8 5,931 Nov-11-2019, 12:54 PM
Last Post: mdalireza
  xml replacement with python josesalazmit 3 10,569 Feb-24-2019, 07:28 PM
Last Post: stullis
  Best replacement for pyzmail in lines 15 and 16 Pedroski55 0 3,584 Nov-03-2018, 06:12 AM
Last Post: Pedroski55
  Is pathlib a viable replacement for os.path? j.crater 4 13,035 Jan-13-2018, 09:49 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020