There is no rule that specifies which occupations need an article because there is a usage rule that when identifying someone's occupation you do not require an indefinite article. This is why so many of the following comments are questioning the una here: Soy granjera means exactly the same thing as Yo soy una granjera.
Thing is, just like the inclusion of yo here, the usage rule is not a grammatical rule. There is nothing especially "wrong" about including the article if the context makes sense, like one wanted to emphasize their belonging to that occupation, if their occupation was not what they were best known for, or if it was a role they were in temporarily rather than their true occupation.
- George Washington might say "Yo soy un granjero" if people asked why he was quitting the presidency after only two terms in office.
- It could also be what an actor says about the part they landed in a new play.
- It could also be what someone says about the character they play in a video game.
Keep in mind though that one does always include an article if the occupation is modified by an adjective.
- Yo soy una granjera de 49 años