#๐Ÿ”’ Why do I need to put sqlalchemy engine in the first line?

12 messages ยท Page 1 of 1 (latest)

pearl trellis
#

I dont know why, but the query would not do anything (and return no errors) if it was located anywhere else. Even putting the engine intialization below import pandas results in the query (and all my code) not working, but it seems I can put the initialization below some imports like dotenv and openpyxl?? I'm new to SQL/MySQL but I have no clue what the issue might be stemming from, I would appreciate any help.

https://github.com/PotatoShaga/DotaApi (at the top of script.py)

GitHub

Contribute to PotatoShaga/DotaApi development by creating an account on GitHub.

meager ridgeBOT
#

@pearl trellis

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

floral pagoda
#

What kind of failures do you see? I use some sqlalchemy if only make the engine when I set up db connections.

I'm wondering if this is some DotaApi thing rather than sqlalchemy itself.

pearl trellis
floral pagoda
#

Have you tried moving the call to initialize_engine() down one line at a time until things break?

pearl trellis
#

Yes. initialize_engine() being below importing pandas and/or any DotaApi files (except initialize_connections, where initialize_engine is located) causes it to break.

#

All others are fine. Im not sure why the order of initialize_engine() matters anyways, as all this function does is create the sql engine with a string. like the imports shouldn't affect this string and engine, so why does it matter??

floral pagoda
#

Yeah. I was wondering if some subsequent dotaapi things expect it to exist at import time. Odd.

#

Do you actually get an exception and stack trace?

#

Why pandas would affect anything is beyond me ๐Ÿ˜ฆ

meager ridgeBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.