<prompt> Tengeneza seva ya Python FastAPI inayoauni shughuli za CRUD za kudhibiti mkusanyiko wa vitabu kichwa, mwandishi, mwaka wa uchapishaji. Unganisha seva hii na hifadhidata ya PostgreSQL na utekeleze utaftaji wa kuorodhesha vitabu vyote.PLINFORMAT  <response>: kutoka fastapi kuleta FastAPI, HTTPExceptionkutoka kwa pydantic import BaseModelkutoka kwa kuchapa Orodha ya kuingizakuagiza hifadhidatakuagiza sqlalchemykutoka sqlalchemy import create_enginekutoka sqlalchemy.ext.declarative import declarative_basekutoka sqlalchemy.orm import sessionmakerDATABASE_URL postgresql:username:passwordlocalhostdbnamehifadhidata hifadhidata. HifadhidataDATABASE_URLmetadata sqlalchemy.MetaDatainjini create_engineDATABASE_URLSessionLocal mtayarishaji kikaoautocommitUongo, autoflushUongo, fungainjiniMsingi declarative_basevitabu_meza sqlalchemy.Jedwali vitabu, metadata, sqlalchemy.Columnid, sqlalchemy.Integer, primary_keyTrue, sqlalchemy.Columnkichwa, sqlalchemy.String, sqlalchemy.Columnmwandishi, sqlalchemy.String, sqlalchemy.Columnpublication_year, sqlalchemy.Integer,Base.metadata.create_allbindengineclass BookInBaseModel: kichwa: str mwandishi: str uchapishaji_mwaka: intKitabu cha darasa BookIn: kitambulisho: int Usanidi wa darasa: orm_mode Kweliapp response_modelKitabuasync def create_bookkitabu: BookIn: swala books_table.insert.valuesbook.dict last_record_id subiri hifadhidata.executehoja rudisha book.dict, id: response_modelOrodhaKitabuasync def read_booksruka: int 0, kikomo: int 10: swala books_table.select.offsetruka.kikomokikomo vitabu subiri hifadhidata.fetch_allswali kurudi response_modelKitabuasync def read_bookkitabu_kitabu: int: swala books_table.select.wherebooks_table.c.id book_id kitabu subiri hifadhidata.fetch_oneswali ikiwa sio kitabu: ongeza HTTPExceptionstatus_code404, detailsKitabu hakijapatikana kitabu cha response_modelKitabuasync def update_bookkitabu_kitabu: int, kitabu: BookIn: swali book_table.sasisha .wapibooks_table.c.id book_id .valuesbook.dict .kurudishavitabu_meza.c updated_book subiri hifadhidata.fetch_onehoja ikiwa haijasasishwa_kitabu: ongeza HTTPExceptionstatus_code404, detailsKitabu hakijapatikana rudisha response_modelintasync def delete_bookkitabu_kitabu: int: swala books_table.delete.wherebooks_table.c.id book_id.returningbooks_table.c.id deleted_book_id subiri hifadhidata.fetch_valhoja kama haijafutwa_kitambulisho_cha_kitabu: ongeza HTTPExceptionstatus_code404, detailsKitabu hakijapatikana rudisha def startup: subiri def shutdown: subiri hifadhidata.disconnect 