In politics, it’s generally better to be lucky then good. Especially since if you’re lucky enough, you’ll always look good.

And when things are going well, don’t screw up.

San Francisco Mayor Ed Lee was lucky to be appointed to San Francisco’s top job in January 2011, when the Great Recession that had hammered California for years was starting to ease.

But Lee didn’t screw up and San Francisco is starting to reap the benefits.

Last week, Lee introduced a two-year budget that most other California cities can only dream of.

The $7.9 billion proposed budget for each year is $300 million higher than Lee anticipated last May and wipes out a $124 million projected deficit for the fiscal year that begins July 1. There’s money to hire 300 new cops, 120 more firefighters and 300 nurses and other health department workers to help implement the Affordable Care Act reforms coming in 2014.

There’s also $103 million in help to the city’s independent school district, $42 million set aside for affordable housing, more money for capital improvements and street repair and cash to backfill many of the federal cuts made in social service programs.

Lee even boosted the city’s cash reserve by nearly a third.

And how did Lee, who spent more than 20 years as a city bureaucrat, hail his welcome budget news?

“Because of our strategic investments in job creation and economic growth, San Francisco has been spared the deep budget deficits we have experienced over the past several years,” the mayor said in a statement. “This consensus driven, responsible budget reflects my commitment to solve our civic challenges, involve the public and invest in our infrastructure and workforce.”

I did mention that Lee was a bureaucrat, right?

But that’s all right with San Franciscans, who elected the political rookie to his own four-year term in November 2011. After 15 years of high-visibility, high-maintenance mayors like former Assembly Speaker Willie Brown and current Lt. Gov. Gavin Newsom, the city was ready for a drama-free problem solver.

Lee, who had spent time as public works director and city administrator, knew budgets and knew city government and immediately sat down to try and clear away some of the fiscal debris – and red ink – left by the recession.

And here’s where the luck comes in. While politicians everywhere have plenty of good ideas, none of those ideas are worth much if there isn’t money to put them into action. Newsom, for example, had big plans for reviving San Francisco’s economy, but with the recession in full swing, they went nowhere.

But when Lee, a couple years later, put out many of the same plans, there was suddenly money to get those projects moving.

Lee took advantage of a surge in the tech industry to promise tax breaks and convince companies like Twitter, Salesforce, Zynga, Airbnb and others to either move into or expand in San Francisco. And the influx of young, high-paid tech workers has spurred a boom in apartment construction, restaurants, bars and entertainment. It’s now the city where the cool kids live – and spend their money.

As Joel Kotkin said on this blog a few days back, his recent survey found that San Francisco is now considered the best place in the nation for jobs. Unemployment, which was 9 percent when Lee took office in January 2011, is now 5.4 percent.

Not everything’s roses. Chinese financing recently fell through on a couple of huge local development projects. Housing prices are sky-high, forcing many middle-class families out of the city. There’s a continuing demand for social services that even the city’s growing budget can’t meet. And a crowded city is growing even bigger and plenty of long-time residents aren’t happy about it.

Politicians always get too much credit when things are good and too much blame when the economy goes sour. The business cycle is an inexorable machine that’s only minimally responsive to officeholders’ bright and not-so-bright ideas.

Still, things can always get worse and to Lee’s credit, in San Francisco they haven’t. He’s proven that a totally flash-free mayor, with only minimal political skills, can put his mark on a big California city by doing his job efficiently and effectively. Unlike some of his predecessors and compatriots, Lee doesn’t have to be, as his daughter once said of Theodore Roosevelt, “the corpse at every funeral, the bride at every wedding and the baby at every christening.”

“He didn’t screw up” doesn’t sound like much of an epitaph, but if it could be said of more politicians, California and the country would be better off.

John Wildermuth is a longtime writer on California politics.