Created
February 20, 2025 22:27
-
-
Save NadiaaOliverr/e109c161f78148f219e86422e1a1d7a3 to your computer and use it in GitHub Desktop.
Gist para o artigo de SQLAlchemy em Python
This file contains hidden or 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.orm import sessionmaker | |
| from conexao import engine | |
| from modelos import Funcionario | |
| Session = sessionmaker(bind=engine) | |
| session = Session() | |
| funcionarios = session.query(Funcionario).all() | |
| for funcionario in funcionarios: | |
| print(f"ID: {funcionario.id}, Nome: {funcionario.nome}, Cargo: {funcionario.cargo}") | |
| session.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment