We present a text-to-program framework for studying the urban history of Venice from 1740 to 1808. This framework leverages large-scale language models (LLMs) to translate natural language queries into executable code for analyzing historical cadastral records. It performs complex analyses using two technologies: SQL agents and coding agents, and proposes a classification scheme that categorizes research questions based on their complexity and analysis requirements. This system proves effective in reconstructing historical population information, real estate characteristics, and spatiotemporal comparisons.