Answers.Body: <p>Directly accessing the SQL tables is certainly possible, but not a recommended approach. Reporting (ie read only) is safer than attempting to write to the tables but there can be many tables to join correctly depending on what you are trying to do.</p>
  
  <p>If the standard reports and the various <a href="https://civicrm.org/extensions?title=&amp;body_value=&amp;field_extension_cms_tid=All&amp;field_extension_ready_value=All&amp;tid_4%5B%5D=96&amp;sort_by=field_extension_current_usage_value&amp;sort_order=DESC" rel="nofollow noreferrer">reports extensions</a> don't provide what you need, try getting your data via the <a href="https://docs.civicrm.org/dev/en/latest/api/" rel="nofollow noreferrer">API</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-21T16:27:24.123Z
Answers.LastActivityDate: 2019-08-21T16:27:24.123Z
Answers.UserDisplayName: Aidan
Body: <p>I would like to use Python and SQLalchemy to construct queries and create reports for Civicrm. Has anyone mapped the Classes and Relationships in order to use the ORM capabilities of SQLAlchemy?</p>
  
Tags: <mysql>
Title: Has anyone mapped the CiviCRM Schema to Classes in SQLAlchemy?
ThreadText: # Has anyone mapped the CiviCRM Schema to Classes in SQLAlchemy?
  
  (Asked by: username_0 on 2019-08-21)
  
  I would like to use Python and SQLalchemy to construct queries and create reports for Civicrm. Has anyone mapped the Classes and Relationships in order to use the ORM capabilities of SQLAlchemy?
  
  **Tags:** mysql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-21. Score: 1
  
  Directly accessing the SQL tables is certainly possible, but not a recommended approach. Reporting (ie read only) is safer than attempting to write to the tables but there can be many tables to join correctly depending on what you are trying to do.
  
  If the standard reports and the various [reports extensions](https://civicrm.org/extensions?title=&body_value=&field_extension_cms_tid=All&field_extension_ready_value=All&tid_4%5B%5D=96&sort_by=field_extension_current_usage_value&sort_order=DESC) don't provide what you need, try getting your data via the [API](https://docs.civicrm.org/dev/en/latest/api/).
  
  
  ---
  
  