Even with a dwarf, I probably wouldnt keep it in anything less than a 10 gallon. 3 gallons doesnt have enough mistake room for me
But then again Dwarves will struggle to survive in anything more than a 10 gal usually as they find it very hard to find foods in anything larger
And that is why dwarfs aren't recommended for beginners.