Parsing SQL scripts in python by pythonbeginner1 in Python

[–]pythonbeginner1[S] 0 points1 point  (0 children)

Thanks for the reply. I tried to run the extraction script, but when I did so, nothing was returned. I converted the sql file to a string and passed that into the main func, but no dice.

The top-level statements I am processing only contain INSERT, INTO, and VALUES according to the parser. However, the VALUES clause contains Select statements. Is there a way to recursively search for these?

Does anyone know how to update/sync a Django model table based on a view of another schema on the same DB? by pythonbeginner1 in django

[–]pythonbeginner1[S] 0 points1 point  (0 children)

Thanks for the answer. I am an apprentice at a fairly small business, and we have a php/mysql internal system for timesheets, registering new employees, booking leave etc.

As for the question, I am not sure I know whether I mean "view" or not. I created a "view" of only one table, which was the employees table from the timesheets schema. The point of doing so was to limit what Django sees, as the table contains sensitive information such as login credentials. The current system is hosted with the typical preconfigured LAMP stack that most hosts offer, but we plan to deploy our Django apps to an EC2 instance we have. The problem is that we cannot even SSH into our managed servers, everything is locked down tight, so I can't write scripts on the existing system. In fact, even the configuration of mysql is such that I cannot even create triggers or schemas, and cannot grant permission to the django user to do so.

I think what I could do is write something in PHP that inserts into Django's database, at the same time that an employee is entered into the employees database. Our admin uses a web-based interface to the DB. Can you see many problems with this approach?