Python Match Case Substring Method Sqlite Database Is Locked