Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import pandas as pd
- from sqlalchemy import create_engine
- db_config = {'user': 'my_user',
- 'pwd': 'my_user_password',
- 'host': 'localhost',
- 'port': 5432,
- 'db': 'games'}
- connection_string = 'postgresql://{}:{}@{}:{}/{}'.format(db_config['user'],
- db_config['pwd'],
- db_config['host'],
- db_config['port'],
- db_config['db'])
- engine = create_engine(connection_string)
- query = ''' SELECT game_id, name, platform, year_of_release
- FROM data_raw
- '''
- data_raw = pd.io.sql.read_sql(query, con = engine, index_col = 'game_id')
- print(data_raw.info())
- print(data_raw.head(5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement