Ok. Thanks, Mike On Apr 6, 2017 6:46 PM, "Mike Bayer" <[email protected]> wrote:
> You can't use bound parameters for identifiers like table names, bound > parameters are only for literal values which doesn't really apply to COPY. > COPY is a special administration statement you should pass in as a complete > statement. > > On Apr 6, 2017 6:01 PM, "Darin Gordon" <[email protected]> wrote: > > I'm trying to bulk-load into a postgres database using the COPY facility. > The problem I'm facing is that sqlalchemy is including quotes for the table > name during binding and postgres raises an exception due to the quotes: > > conn.execute(text("""COPY :tbl_name from :csv_path (format > :file_format, delimiter :delim, quote :quote)"""), > tbl_name=tbl_name, > file_format=file_format, > csv_path=csv_path, > delim=delim, > quote=quote) > > > Postgres raises with an exception on tbl_name. If, for instance, > tbl_name = 'my_table' , sqlalchemy is binding it to: "COPY 'my_table' > ....' when instead it must be "COPY my_table ...." > > What's the recipe to handle this literal value? > > Thanks :) > > > -Darin > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 a topic in the > Google Groups "sqlalchemy" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/sqlalchemy/F81oZ8h7s2s/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
