Re: [sqlalchemy] sqlalchemy get table with a string

2021-03-17 Thread Simon King
OK, I see. You're creating tables dynamically, and you want to be able to insert data into those tables. I think it'll be easier to use SQLAlchemy Core for this, rather than the ORM. You can use reflection to load table definitions from the database.

Re: [sqlalchemy] sqlalchemy get table with a string

2021-03-17 Thread FURKAN bilgin
I updated sqlalchemy and now I get an error when accessing the database. And their codes need to be coded: What I really wanted to do was add data to a table with json data in the / main / write path. but now I get an error when I send / main / new-app post request (I updated sqlalchemy and it

Re: [sqlalchemy] sqlalchemy get table with a string

2021-03-17 Thread Simon King
I assumed you were defining classes corresponding to your database tables, as shown here: https://docs.sqlalchemy.org/en/14/orm/tutorial.html#declare-a-mapping If that's not how you're using SQLAlchemy, you'll have to show your code. Simon On Wed, Mar 17, 2021 at 2:07 PM FURKAN bilgin wrote:

Re: [sqlalchemy] sqlalchemy get table with a string

2021-03-17 Thread FURKAN bilgin
I think we keep it in RAM in the first method, so it may be a problem if the program is restarted. and I guess I don't understand what you mean by Base class. 17 Mart 2021 Çarşamba tarihinde saat 14:27:31 UTC+3 itibarıyla Simon King şunları yazdı: > There are lots of ways of doing this. One

Re: [sqlalchemy] sqlalchemy get table with a string

2021-03-17 Thread Simon King
There are lots of ways of doing this. One option is to provide a dictionary when creating your declarative_base: classes = {} Base = declarative_base(class_registry=classes) Now you can look up classes by name in that classes dictionary: def get_table_by_name(name): return