r/Python • u/[deleted] • Dec 29 '22
Discussion Is SQL a prerequisite to learning Python ?
I would like to learn how to automate some simple tasks like : 1- downloading an attachment from outlook, change its name and save to a specific folder
2- save an excel sheet as PDF then send it via outlook … with changing dates on the subject line of the email.
Do I need to learn SQL , then move to Python to learn automating such tasks ? Or I can jump in and start learning Python with very BASIC COMMON knowledge of SQL?
23
u/HorsesFlyIntoBoxes Dec 29 '22
This is like asking if using a saw is prerequisite to using a screwdriver. They are simply different tools for different things.
7
u/SilentProgramer4D63 Dec 29 '22
No. I didn't learn SQL until about two years after learning basic python
5
5
8
4
u/Natural-Intelligence Dec 29 '22
Python's ecosystem is so vast that you can do a lot with some basic level knowledge of Python + libraries. I hate to promote my work but I have a collection of open-source libraries that you might find useful:
Making sending email easy: https://red-mail.readthedocs.io/
Making reading emails easy: https://red-box.readthedocs.io/
Abstracting databases so that you don't need SQL: https://red-bird.readthedocs.io/
Intuitive scheduling framework: https://rocketry.readthedocs.io/
Then for saving Excel files you can use Pandas and xlsxwriter. Then to save to PDF you can use Pandas with Latex. This requires a bit more knowledge but you can execute Python inside Latex using pythontex.
There is a lot you can do with Python with very limited knowledge. I also started with simply automating small things with elementary knowledge of Python and Pandas and now build systems in a bank.
1
u/JohnJSal Dec 30 '22
Why do you think they are even related? You don't have to know any SQL to learn and use Python, but if you ever need to later, Python even has a built-in library called sqlite3 for light database use.
1
Dec 30 '22
I have nothing to do with coding and want learn .. so my level is VERY beginner.
All people I know who work on Python they talk about SQL . So I assumed it is a prerequisite of Python.
1
u/JohnJSal Dec 30 '22
Ah well, in that case, just know that SQL is a totally different language (not really a programming language like Python, C#, Java, etc.) and is used for when you need to create and work with databases.
Eventually you may want to do this, but learning Python can definitely be done without it.
2
u/TheITMan19 Dec 29 '22
If the host computer is Windows, I’d be looking at using Powershell rather than Python. No SQL required, relatively simple tasks
2
u/BoiElroy Dec 29 '22
You certainly do not have to know SQL to do the types of things you're describing.
Step 1) Do the code academy python courses just to get a feel for the language, syntax and basics.
Step 2) Read the book "Automate the Boring stuff" that shows how to use Python for a variety of useful automation like the type you're describing. And follow along and actually build some of the stuff
Step 3) Profit
Good luck!
1
1
1
1
-2
Dec 30 '22 edited Dec 30 '22
I write Python for a living and don’t know anything about SQL. Literally nothing.
ETA- why is this being downvoted? I never learned SQL because I use Mongo so I’ve never have any need for it; I’m not saying it’s not important, but I work in a berry specific field. If I did have need for it then I’d learn it.
51
u/space_wiener Dec 29 '22
Nope. I’ve written hundreds of scripts and apps, maybe two of those interacted with SQL and I googled most of the syntax I needed.
SQL is for databases. What you described has nothing to do with that.