0

First of all I'd like to thank this community, I'm still not knowledgeable enough to answer questions but when I can I'll make sure to give back.

I currently have two pieces of code that I'm trying to combine.

1) An SQL query that pulls a bunch of data and I save it as a CSV file 2) A Jupyter notebook that opens that CSV as a Pandas Dataframe and performs some calculations and plots some graphs.

Every time that I run a new report I need to make some edits to the SQL code first, I need to change some dates and the Unit number from which I'm trying to pull the data.

Would it be possible to do all of this directly from the Python code?

I was thinking that if I can declare some "placeholders" in the SQL code and then I can specify those dates in Jupyter Notebook then I could just plug them in and run both codes at once.

Thank you in advance for any help.

adrian
  • 148
  • 8
  • 1
    Have you looked into [`pandas.read_sql()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql.html)? Have a look at [this question](https://stackoverflow.com/questions/24408557/pandas-read-sql-with-parameters), it looks like it might exactly answer your question. – Mihai Chelaru May 05 '19 at 15:32
  • Please continue your StackOverflow research. There are a plethora of Python/SQL questions particularly regarding parameterized queries between frontend application layer to backend database. This is a regular need in modern programming beyond Python and SQL Server. – Parfait May 05 '19 at 17:01

0 Answers0