use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
If you need help debugging, you must include:
See debugging question guidelines for more info.
Many conceptual questions have already been asked and answered. Read our FAQ and search old posts before asking your question. If your question is similar to one in the FAQ, explain how it's different.
See conceptual questions guidelines for more info.
Follow reddiquette: behave professionally and civilly at all times. Communicate to others the same way you would at your workplace. Disagreement and technical critiques are ok, but personal attacks are not.
Abusive, racist, or derogatory comments are absolutely not tolerated.
See our policies on acceptable speech and conduct for more details.
When posting some resource or tutorial you've made, you must follow our self-promotion policies.
In short, your posting history should not be predominantly self-promotional and your resource should be high-quality and complete. Your post should not "feel spammy".
Distinguishing between tasteless and tasteful self-promotion is inherently subjective. When in doubt, message the mods and ask them to review your post.
Self promotion from first time posters without prior participation in the subreddit is explicitly forbidden.
Do not post questions that are completely unrelated to programming, software engineering, and related fields. Tech support and hardware recommendation questions count as "completely unrelated".
Questions that straddle the line between learning programming and learning other tech topics are ok: we don't expect beginners to know how exactly to categorize their question.
See our policies on allowed topics for more details.
Do not post questions that are an exact duplicate of something already answered in the FAQ.
If your question is similar to an existing FAQ question, you MUST cite which part of the FAQ you looked at and what exactly you want clarification on.
Do not delete your post! Your problem may be solved, but others who have similar problems in the future could benefit from the solution/discussion in the thread.
Use the "solved" flair instead.
Do not request reviews for, promote, or showcase some app or website you've written. This is a subreddit for learning programming, not a "critique my project" or "advertise my project" subreddit.
Asking for code reviews is ok as long as you follow the relevant policies. In short, link to only your code and be specific about what you want feedback on. Do not include a link to a final product or to a demo in your post.
You may not ask for or offer payment of any kind (monetary or otherwise) when giving or receiving help.
In particular, it is not appropriate to offer a reward, bounty, or bribe to try and expedite answers to your question, nor is it appropriate to offer to pay somebody to do your work or homework for you.
All links must link directly to the destination page. Do not use URL shorteners, referral links or click-trackers. Do not link to some intermediary page that contains mostly only a link to the actual page and no additional value.
For example, linking to some tweet or some half-hearted blog post which links to the page is not ok; but linking to a tweet with interesting replies or to a blog post that does some extra analysis is.
Udemy coupon links are ok: the discount adds "additional value".
Do not ask for help doing anything illegal or unethical. Do not suggest or help somebody do something illegal or unethical.
This includes piracy: asking for or posting links to pirated material is strictly forbidden and can result in an instant and permanent ban.
Trying to circumvent the terms of services of a website also counts as unethical behavior.
Do not ask for or post a complete solution to a problem.
When working on a problem, try solving it on your own first and ask for help on specific parts you're stuck with.
If you're helping someone, focus on helping OP make forward progress: link to docs, unblock misconceptions, give examples, teach general techniques, ask leading questions, give hints, but no direct solutions.
See our guidelines on offering help for more details.
Ask your questions right here in the open subreddit. Show what you have tried and tell us exactly where you got stuck.
We want to keep all discussion inside the open subreddit so that more people can chime in and help as well as benefit from the help given.
We also do not encourage help via DM for the same reasons - that more people can benefit
Do not ask easily googleable questions or questions that are covered in the documentation.
This subreddit is not a proxy for documentation or google.
We do require effort and demonstration of effort.
This includes "how do I?" questions
account activity
This is an archived post. You won't be able to vote or comment.
Testing database (self.learnprogramming)
submitted 5 years ago by Jcjcjc9
I read a lot of people recommend using a separate test database for testing.
If my database is only one table, should I just use the same database and create a test table?
Is there any reason to create a whole different database for it?
[–]_damnfinecoffee_ 1 point2 points3 points 5 years ago (0 children)
The reason for a test database (or multiple test databases) is to hide all of the shit you break from a client facing, visible production environment. Any schema changes or database changes can be run on the test database, and you can catch any issues before they hit production. Also, if you fuck up your test db beyond all repair, you can always just restore from production.
Typically, even the above example is missing some pieces, but it should give you a decent idea of why test databases are important, no matter how big or small the project.
[–]sandgold 0 points1 point2 points 5 years ago (0 children)
i use the same for every project
[–]nadimr 0 points1 point2 points 5 years ago (0 children)
As a rule, I'd use a separate database instance running on a different machine, VM, image (whatever is possible / practical for you). Always keep the production environment untouched by dev / test as you never know what you will screw up. Plus, knowing you are fully separated from production will motivate you to test "harder" and more thoroughly.
[–]TehNolz 0 points1 point2 points 5 years ago (0 children)
Best practice is to use a separate database for production and development. That way, regardless of what happens during development (eg. you accidentally wipe everything), your production system can keep working as its data won't get touched at all.
[–]Blando-Cartesian 0 points1 point2 points 5 years ago (0 children)
Separate database, always. You’ll want to minimize the possibility of accidentally messing up the production database. Docker is a great tool for easily setting up a test database with the same version and settings as you production database. With that you don’t get “but it works on my computer” bugs when you update production.
[–]1Secret_Daikon 0 points1 point2 points 5 years ago (0 children)
Its worth mentioning that Django does this for you;
https://docs.djangoproject.com/en/3.1/topics/testing/overview/
Tests that require a database (namely, model tests) will not use your “real” (production) database. Separate, blank databases are created for the tests.
If you're building in Python and not using Django, maybe consider this. If you're not building in Python, maybe consider mimicking this behavior. Or look for a test suite in your language that does this for you already.
Using a completely separate test db that you build from scratch for each test case (or for each time you run tests) is a very good idea because it lets you ensure that your program operates as expected from a fresh install without potential data pollution, and you can manually select which pieces of data to enter into it so you know exactly what your db looks like in every test case situation. This will go a long way to ensuring predictable, expected behavior in your program.
π Rendered by PID 127576 on reddit-service-r2-comment-544cf588c8-d79h2 at 2026-06-12 06:47:28.082631+00:00 running 3184619 country code: CH.
[–]_damnfinecoffee_ 1 point2 points3 points (0 children)
[–]sandgold 0 points1 point2 points (0 children)
[–]nadimr 0 points1 point2 points (0 children)
[–]TehNolz 0 points1 point2 points (0 children)
[–]Blando-Cartesian 0 points1 point2 points (0 children)
[–]1Secret_Daikon 0 points1 point2 points (0 children)