Being forced to move in the middle of the school year because the owner want to sell the house kind of sucks, though 5 years of a month-to-month was a bad idea. More landlords are asswipes than not, being able to control your own destiny has advantages. After all, you are paying all of the costs plus a premium for the rental, and you don't even get the paint or floor covering you want, let alone nice things.
Or you need to have decent tenant protection laws.
In SF, you can’t evict tenants because you sell the house, and you can’t evict tenants with kids during the school year (without a just cause).
that's the nice thing about renting in germany. there this would not work, the owner can sell the house but they can't kick out the tenant. so whoever is buying is taking over the tenant. and while you can ask a tenant to move out if you need the house for yourself, that too has to consider the needs of the tenant. if they have kids in school it is almost impossible to remove them unless you go out of your way to help them find a new place and they are not forced to switch schools.