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
<janio...@gmail.com> wrote:
>
> 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 <si...@simonking.org.uk> wrote:
>>
>> 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:
>>
>> https://docs.sqlalchemy.org/en/14/core/tutorial.html#executing-multiple-statements
>>
>> Hope that helps,
>>
>> Simon
>>
>> On Wed, Feb 23, 2022 at 8:42 PM janio mendonca junior
>> <janio...@gmail.com> wrote:
>> >
>> > Hi all,
>> >
>> > I have a inquiry from my job to create 2 tables related one-to-one and 
>> > insert some rows on the table. I have a .CSV with the data dictionary from 
>> > the table and I am wondering to know how to declare the tables columns 
>> > automatically without write one by one column (there are 260 columns). 
>> > Same thing for the insert, how to add rows to the multiple columns table 
>> > without write column by column?
>> >
>> > I have the data in a Data frame but I was not able to insert it using 
>> > df.to_sql from pandas. Do you guys have any similar example?
>> >
>> > Thank you all
>> >
>> > --
>> > SQLAlchemy -
>> > The Python SQL Toolkit and Object Relational Mapper
>> >
>> > http://www.sqlalchemy.org/
>> >
>> > To post example code, please provide an MCVE: Minimal, Complete, and 
>> > Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
>> > description.
>> > ---
>> > You received this message because you are subscribed to the Google Groups 
>> > "sqlalchemy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to sqlalchemy+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/sqlalchemy/CADF7wwb0_ncRuU_CadqFegE9583W-xWWD4x%3DGy8V%3DgW0jKtcyg%40mail.gmail.com.
>>
>> --
>> SQLAlchemy -
>> The Python SQL Toolkit and Object Relational Mapper
>>
>> http://www.sqlalchemy.org/
>>
>> To post example code, please provide an MCVE: Minimal, Complete, and 
>> Verifiable Example.  See  http://stackoverflow.com/help/mcve for a full 
>> description.
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sqlalchemy+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sqlalchemy/CAFHwexexvrpmr%3DEA4w%3DmncyiKyxj0yk%3Dcr9_%2Br%3Db3MCyOiHg%3DA%40mail.gmail.com.
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> ---
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/CADF7wwYLD-OrxU9-Eq5mnSMoCBJ-EcFEcD%3DVXUEJJNLCx_dOjw%40mail.gmail.com.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAFHwexfbN8Wt6MPp1PY6-gptjL5zdMmjy5z5YAFsczdgES%2B8Uw%40mail.gmail.com.

Reply via email to