Monday, July 27, 2020

Re: Data Science and sql problem

Hi Friend,

If you want more option, new t-sql with predict statement directly on db.



On Mon, Jul 27, 2020, 4:25 PM AJ Wattoo <wattoorocx@gmail.com> wrote:
as far i understand you want to connect with postgreSQL database on jupyter notebook :
you can do like this
1. install -c anaconda psycopg2 and install -c anaconda sqlalchemy

2. from sqlalchemy import create_engine and import pandas as pd

3. engine=create_engine('postgres+psycopg2://postgres:0000@localhost:5432/anyname')

In thes case postgres = name of my databse , 0000 is my password , localhost=host, port = 5432, anyname = database name

4. con = engine.connect()

5. df=pd.read_sql_query(SQL queries #whatever you want to get from database)

and then saving that data in csv 

6. df.to_csv('file_name.csv')
On Monday, July 27, 2020 at 6:37:44 AM UTC+2 yame...@gmail.com wrote:
Try sql alchemy, if you need a full access with many functionality. Other than that, u can connect directly to the database through python. The exact implementation will depend on the database type

Le dim. 26 juil. 2020 à 18:15, Gurmeet Kaur <gurmeetka...@gmail.com> a écrit :
you could try using connection and cursor to connect nd then pandas to read csv using readcsv function

On Sun, Jul 26, 2020, 11:59 AM Prashant Singh <prashant...@gmail.com> wrote:
How can i connect database with help of function in jupyter notebook and then conver data into csv to build model ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dd90d45a-dfbf-47a6-86b2-a4e600d4a9c9n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/97217142-867e-4f5a-9c52-17fa3a6f7ce6n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP5HUWr19SEW4L8Or4UswhtXgNQtcTwbdRYkrgYHdELh-JL%2BOQ%40mail.gmail.com.

No comments:

Post a Comment