Created
December 10, 2017 01:35
-
-
Save csabatini/392313c851ceebda31a04bd3d98b7c07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import * | |
engine = \ | |
create_engine("postgresql://...@localhost:5432/nfldb") | |
metadata = MetaData(bind=engine) | |
teams = Table('team', metadata, autoload=True) | |
players = Table('player', metadata, autoload=True) | |
inputname = input('input a player name:') | |
conn = engine.connect() | |
s = select([players.c.player_id, players.c.first_name, players.c.last_name, | |
players.c.full_name]).where(players.c.full_name.ilike(inputname)) | |
result = conn.execute(s) | |
print(result.fetchone()) | |
print(type(players.c.player_id)) | |
print(str(players.c.player_id)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment