De Wiki inetshell
Saltar a: navegación, buscar

https://towardsdatascience.com/sqlalchemy-python-tutorial-79a577141a91

import sqlalchemy as db
engine = db.create_engine('sqlite:///census.sqlite')
connection = engine.connect()
metadata = db.MetaData()
census = db.Table('census', metadata, autoload=True, autoload_with=engine)

# Print the column names
print(census.columns.keys())

# Print full table metadata
print(repr(metadata.tables['census']))

#Equivalent to 'SELECT * FROM census'
query = db.select([census])

ResultProxy = connection.execute(query)

ResultSet = ResultProxy.fetchall()