I don't think dragons can attack in citites that you have to enter gates like riften, whiterun, etc. ...cities you can walk thru freely require no load screens so therefore dragons and other creatures can follow you in and attack the same way as walking the wild
Keep thinking that. And when they take you by surprise because you felt safe in those walls and fry half the town's population because you weren't ready... well, you'll learn
that pain eventually. Trust me, I learned it the hard way. Never let your guard down.
Dragons can and do attack inside cities. It's rare, but it does happen. Out of the ninety or so dragons I've slain, at least ten were inside city walls. In fact, the only city I haven't fought one in is Markarth.