Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. Define your models (Python classes) using SQLAlchemy's declarative syntax.
  2. Create a SQLAlchemy engine that's configured to connect to your Cloud Spanner instance.
  3. Create a session using the SQLAlchemy sessionmaker, passing in the engine you created in step 2.
  4. In your code, query the session to retrieve rows from the database using standard SQLAlchemy syntax.
  5. SQLAlchemy will automatically map the row data to instances of your model classes, giving you rich, object-oriented access to your data.
  6. Use the model instances to manipulate the data and perform any necessary calculations or transformations.
  7. When you're ready to save your changes back to the database, use the session to commit the changes or rollback if there were any errors.