![]() |
Multi Select from SQL - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Multi Select from SQL (/thread-30267.html) |
Multi Select from SQL - tehzeebahmed - Oct-13-2020 Hi Gurus, I am planning to get multiple values from single select from Database and use it in the code further down as per the need of the project. I am trying like this FeedId[] = Select column1, column2, column3 from MyTable Id=FeedId[0] BatchId=FeedId[1] MyLoc=Feedid[2] but this is not working. could you please share how to get these multiple values get extracted. RE: Multi Select from SQL - Larz60+ - Oct-13-2020 I'd suggest using SqlAlchemy, tutorial here: SQLAlchemy Tutorial It is much easier to use once setup. RE: Multi Select from SQL - tehzeebahmed - Oct-13-2020 Hi Larz, I need in this format when we have a single record and do not need loop Local_id = pd.read_sql_query('select ISNULL(max(Id),0)+1 from firstTable', conn) Local_id # ============================================================================= # Now Select One value from the DB to local variable # and setting up few columns those are not from Data File # ============================================================================= oLid=Local_id.loc[0] oLid RE: Multi Select from SQL - tehzeebahmed - Oct-13-2020 anyone? Hi Experts. need your help RE: Multi Select from SQL - tehzeebahmed - Oct-15-2020 Hi Experts, can anyone help me here? RE: Multi Select from SQL - ibreeden - Oct-16-2020 (Oct-13-2020, 10:29 AM)tehzeebahmed Wrote: Local_id = pd.read_sql_query('select ISNULL(max(Id),0)+1 from firstTable', conn)But what is your question? Does it work? Does it not give the right result? Do you get an error message? What does table "firstTAble" look like? RE: Multi Select from SQL - scidam - Oct-19-2020 Is the database really huge? What happened if you try to retrieve all elements, e.g. pd.read_sql_query('select * from your_db') ... It is hard to answer questions dealing with external resources... How can we reproduce the problem?!
|