[sqlalchemy] Syntax Checking
Because this is my first SQLAlchemy project and the schema file has 657 lines I would like to check for syntax errors before proceeding with the next step in application development. I find no index in the SA manual and cannot find the string 'syntax check' in the PDF file. Web search turns up nothing (which might be due to wrong search phrase). Is there a way to check for proper syntax prior to having sufficient code to try running the application? Rich
Re: [sqlalchemy] Syntax Checking
On 7/24/15 1:49 PM, Rich Shepard wrote: Because this is my first SQLAlchemy project and the schema file has 657 lines I would like to check for syntax errors before proceeding with the next step in application development. I find no index in the SA manual and cannot find the string 'syntax check' in the PDF file. Web search turns up nothing (which might be due to wrong search phrase). Is there a way to check for proper syntax prior to having sufficient code to try running the application? Python syntax or SQL syntax? Typically in Python we rely on linters and runtime checks for this, same idea with SQL. If the SQL syntax is off, the database will tell you by sending an error to the driver which will result in an exception raise. -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Syntax Checking
On Fri, 24 Jul 2015, Mike Bayer wrote: Python syntax or SQL syntax? Mike, The former. Typically in Python we rely on linters and runtime checks for this, same idea with SQL. Have not used a lint before with Python, but will run it on my SQLAlchemy code. I know that SQLite and postgres let me know in no uncertain terms when my SQL is off. And thanks for yesterday's reply. It forced me out of my rut to look for the proper way to relate all the information ... which I found. Regards, Rich
Re: [sqlalchemy] Syntax Checking
flake8 is super simple - it checks your code for mistakes (undeclared vars, non-runnable code, etc) and pushes you to write pep8 style code. the only things you need to do really are: * write a .cfg for various projects, so you can turn off some warnings * get in the habit of running it before checkins and ALWAYS before merge/deploy. In terms of unit tests, SqlAlchemy implements a lot -- as do other packages you use. Take a look at their source repos -- it's the easiest way to learn. -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Syntax Checking
In terms of linters, `flake8` (https://pypi.python.org/pypi/flake8) catches most mistakes I've made with SqlAlchemy. It's also useful to start writing Unit Tests that will interact with your SqlAlchemy models in predicted ways -- in addition to continually checking core functionality. -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Syntax Checking
On Fri, 24 Jul 2015, Jonathan Vanasco wrote: In terms of linters, `flake8` (https://pypi.python.org/pypi/flake8) catches most mistakes I've made with SqlAlchemy. It's also useful to start writing Unit Tests that will interact with your SqlAlchemy models in predicted ways -- in addition to continually checking core functionality. Jonathan, Sound advice and I'll take both. Haven't used lint since I left C for Python, and understand the value of unit testing while I know nothing about the details of implementing them. Will learn (and apply) flake8 and learn about unit testing before proceeding further. Much appreciated, Rich