sqlite to csv statement 1

sqlite to csv statement

import pandas as pd

conn = sqlite3.connect(db_file, isolation_level=None,
db_df = pd.read_sql_query("SELECT * FROM table", conn)
db_df.to_csv('database.csv', index=False)

Here is what the above code is Doing:
1. Connect to the database file.
2. Read the entire database into a DataFrame.
3. Write the DataFrame to a CSV file.

Similar Posts