django-calaccess-campaign-browser icon indicating copy to clipboard operation
django-calaccess-campaign-browser copied to clipboard

MySQL-specific SQL in management commands

Open dcloud opened this issue 10 years ago • 2 comments

MySQL-specific syntax and settings are used in loadcalaccesscampaignfilings and flushcalaccesscampaignbrowser management commands. The following settings variables are specific to MySQL and so throw a syntax error on other database systems.

  • SQL_NOTES
  • FOREIGN_KEY_CHECKS

The SQL queries should only be executed on MySQL.

Additionally, the TRUNCATE command in PostgreSQL would require the CASCADE option and double quotes rather than backticks.

So there are some MySQL dependency issues…

dcloud avatar Aug 26 '15 19:08 dcloud

You've put your finger on the bleeding edge of our project. While the raw-data app has been massaged to support both MySQL and PostgreSQL, this app currently only works with the former.

The SQL queries you were inspecting are all incomplete. They are only beginnings of our effort to transform, clean and filter the source data into bulk data files the average hacker can grip and rip. It's all alpha and needs exactly the kind of work you're pointing out.

palewire avatar Sep 01 '15 01:09 palewire

I completely understand! I wanted to make note of this since I ran across it and it seemed like a group of issues around SQL copy commands could indicate some tooling for SQL operations might be in order.

I'm spending some time looking into how the various database drives (mysqlclient, psycopg2) might be used to ameliorate the situations where you want to perform interactions closer to the database than the ORM level.

dcloud avatar Sep 01 '15 21:09 dcloud