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 [email protected] 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 <[email protected]> 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 <[email protected]>
>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/dd90d45a-dfbf-47a6-86b2-a4e600d4a9c9n%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/django-users/dd90d45a-dfbf-47a6-86b2-a4e600d4a9c9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 [email protected].
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEbKJVi%3DPfRdjN7AxWiEb-BuUZ_cjwinBpwrbQ9-iTi7e_hyrQ%40mail.gmail.com
>>
>> <https://groups.google.com/d/msgid/django-users/CAEbKJVi%3DPfRdjN7AxWiEb-BuUZ_cjwinBpwrbQ9-iTi7e_hyrQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/97217142-867e-4f5a-9c52-17fa3a6f7ce6n%40googlegroups.com.