write and validate a script to export in xyz mixpanel project to export all uuid created and their current app version details
Hi Akshay J., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To export all UUIDs (assuming these are stored as a user profile property, e.g., $distinct_id
or a custom property like uuid
) and their current app version details from a Mixpanel project, you should use the Engage API to export user profiles, specifying the relevant properties.Below is a Python script using the mixpanel-api
package, which is referenced in Mixpanel's official migration playbook. This script exports user profiles with the desired properties to a CSV file. You need to update the script with your project’s API secret, project token, and the correct property names (replace "uuid"
and "app_version"
with your actual property keys if they differ).LBKSfrom mixpanel_api import MixpanelLBKSif __name__ == '__main__': api_secret = 'YOUR_API_SECRET' project_token = 'YOUR_PROJECT_TOKEN'LBKS m = Mixpanel(api_secret, token=project_token, pool_size=4, debug=True)LBKS # Specify the properties you want to export output_properties = ["uuid", "app_version"] # Update property names as needed parameters = {'output_properties': output_properties}LBKS # Export to CSV m.export_people('people_export.csv', parameters, format='csv')LBKS
Instructions:
1. Install the required package:
pip install mixpanel-api
2. Replace 'YOUR_API_SECRET'
and 'YOUR_PROJECT_TOKEN'
with your actual credentials.
3. Adjust the output_properties
list if your property keys are different.
4. Run the script. The output will be a CSV file with all user UUIDs and their current app version.Validation:
This script is directly based on Mixpanel’s documented approach for exporting user profile data, and the output_properties
parameter is supported for selecting specific fields to export. If you need to confirm the exact property keys, you can inspect your Mixpanel project’s user profile schema in the UI or via the API as described in the documentation.References:
- Exporting Profiles
- Project Migration: Export UsersIf you need to export this data via the API directly (e.g., using cURL), you can use the Engage API and specify the output_properties
parameter as shown in the documentation above.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
i want to do it using service account for which i have the username abc123.mp-service-account and secret as qwerty using code in python
Let me check the knowledge base for you again. One moment! 📚
To export all UUIDs and their current app version details from your Mixpanel project using a service account (username: abc123.mp-service-account
, secret: qwerty
), you can use the mixpanel-utils
Python module, which supports service account authentication and allows you to specify which profile properties to export.Below is a script based on the official documentation. Make sure to replace "uuid"
and "app_version"
with your actual property names if they differ.LBKSfrom mixpanel_utils import MixpanelUtilsLBKS# Initialize MixpanelUtils with your service account credentials mputils = MixpanelUtils( 'qwerty', # Service Account Secret service_account_username='abc123.mp-service-account', project_id='YOUR_PROJECT_ID', # Replace with your actual project ID token='YOUR_PROJECT_TOKEN' # Required for some operations, replace as needed )LBKS# Specify the properties you want to export parameters = { 'output_properties': ['uuid', 'app_version'] # Update property names if needed }LBKS# Export user profiles to a CSV file mputils.export_people('people_export.csv', parameters, format='csv')LBKS
Instructions:
1. Install the required package:
```LBKS2. Replace `'YOUR_PROJECT_ID'` and `'YOUR_PROJECT_TOKEN'` with your actual Mixpanel project details.
3. Adjust the property names in `output_properties` if your schema uses different keys.
4. Run the script. The output will be a CSV file with all user UUIDs and their current app version.LBKSThis approach is validated by the [mixpanel-utils documentation](https://github.com/mixpanel/mixpanel-utils/blob/master/README.md), which describes initializing with a service account and exporting people profiles with selected properties.LBKSIf you need to filter or further customize the export, you can add more parameters as described in the documentation.LBKS> **Note:** The knowledge sources do not provide a way to validate the export within the script itself, but the output file should contain the requested data if the property names are correct and the service account has the necessary permissions.LBKSSource: [mixpanel-utils README](https://github.com/mixpanel/mixpanel-utils/blob/master/README.md)
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.