Hi Simon,
Thank you for your explanation.
I managed to create the table by using df.to_sql. My mistake was because I
was using a serie to sql instead of a dataframe.
On Fri, Feb 25, 2022 at 5:33 AM Simon King wrote:
> I don't know enough about Pandas to explain your error, but I did
>
I don't know enough about Pandas to explain your error, but I did
notice that the SQL that is failing is trying to insert into a table
called "mlstreb", but elsewhere in your code you refer to "mls_treb".
Could that be part of the problem?
To define a table from your CSV file, you could do
Before we do that, you said that you tried pandas dataframe.to_sql but
it didn't work - can you explain what you mean? Did it raise an error,
or produce the wrong result, or something else?
Simon
On Wed, Feb 23, 2022 at 9:13 PM janio mendonca junior
wrote:
>
> Hi Simon,
>
> Thank you for your
Hi Simon,
Thank you for your help. I am brand new working with SQLalchemy, really
appreciate if you explain how to generate the metadata with the list of
column names from the .CSV to create the tables?
On Wed, Feb 23, 2022, 3:52 PM Simon King wrote:
> Build a list of Column objects from the
Build a list of Column objects from the columns in the CSV file, and
use that list to create a Table:
https://docs.sqlalchemy.org/en/14/core/metadata.html
Once you've created the Table, you can insert data into it using the
table.insert() method: