Metadata-Version: 2.2
Name: personal-library-managing-system
Version: 0.2.1
Summary: A CLI-based personal library manager
Author-email: Syeda Darakhshan <darakhshanimranid@gmail.com>
Requires-Python: >=3.13
Description-Content-Type: text/markdown
Requires-Dist: dotenv>=0.9.9
Requires-Dist: inquirer>=3.4.0
Requires-Dist: mysql-connector-python>=9.2.0

<!--Code File to save library data into TXT file  -->
def save_books_to_file(connection, file_path="library.txt"):
    try:
        cursor= connection.cursor()
        query= "SELECT * FROM Books"
        cursor.execute(query)
        results= cursor.fetchall()
        cursor.close()

        with open(file_path, "w") as file:
            for row in results:
                file.write(f"{row}\n")

        print(f"Books data saved to {file_path}")
    except Error as e:
        print(f"Failed to save books to file: {e}")
