hockey-blast-common-lib 0.1.15__tar.gz → 0.1.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. hockey_blast_common_lib-0.1.16/MANIFEST.in +2 -0
  2. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/PKG-INFO +1 -1
  3. hockey_blast_common_lib-0.1.16/hockey_blast_common_lib/dump_sample_db.sh +24 -0
  4. hockey_blast_common_lib-0.1.16/hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz +0 -0
  5. hockey_blast_common_lib-0.1.16/hockey_blast_common_lib/restore_sample_db.sh +34 -0
  6. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib.egg-info/PKG-INFO +1 -1
  7. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib.egg-info/SOURCES.txt +3 -1
  8. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/setup.py +1 -1
  9. hockey_blast_common_lib-0.1.15/MANIFEST.in +0 -2
  10. hockey_blast_common_lib-0.1.15/upload_to_pypi.sh +0 -13
  11. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/README.md +0 -0
  12. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/__init__.py +0 -0
  13. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/aggregate_goalie_stats.py +0 -0
  14. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/aggregate_human_stats.py +0 -0
  15. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/aggregate_referee_stats.py +0 -0
  16. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/aggregate_skater_stats.py +0 -0
  17. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/db_connection.py +0 -0
  18. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/models.py +0 -0
  19. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/options.py +0 -0
  20. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/stats_models.py +0 -0
  21. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/utils.py +0 -0
  22. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib/wsgi.py +0 -0
  23. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib.egg-info/dependency_links.txt +0 -0
  24. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib.egg-info/requires.txt +0 -0
  25. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/hockey_blast_common_lib.egg-info/top_level.txt +0 -0
  26. {hockey_blast_common_lib-0.1.15 → hockey_blast_common_lib-0.1.16}/setup.cfg +0 -0
@@ -0,0 +1,2 @@
1
+ include hockey_blast_common_lib/*.sh
2
+ include hockey_blast_common_lib/*.gz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -0,0 +1,24 @@
1
+ #!/bin/zsh
2
+
3
+ # Database credentials from environment variables
4
+ DB_USER=${DB_USER:-"frontend_user"}
5
+ DB_PASSWORD=${DB_PASSWORD:-"hockey-blast"}
6
+ DB_NAME=${DB_NAME:-"hockey_blast_sample"}
7
+ DB_HOST=${DB_HOST:-"localhost"}
8
+ DB_PORT=${DB_PORT:-"5432"}
9
+ DUMP_FILE="hockey_blast_sample_backup.sql"
10
+ COMPRESSED_DUMP_FILE="hockey_blast_sample_backup.sql.gz"
11
+
12
+ # Export PGPASSWORD to avoid password prompt
13
+ export PGPASSWORD=$DB_PASSWORD
14
+
15
+ # Dump the database schema and data
16
+ pg_dump --username=$DB_USER --host=$DB_HOST --port=$DB_PORT --format=custom --file=$DUMP_FILE $DB_NAME
17
+
18
+ # Compress the backup file
19
+ gzip -c $DUMP_FILE > $COMPRESSED_DUMP_FILE
20
+
21
+ # Remove the uncompressed backup file
22
+ rm $DUMP_FILE
23
+
24
+ echo "Database dump completed: $COMPRESSED_DUMP_FILE"
@@ -0,0 +1,34 @@
1
+ #!/bin/zsh
2
+
3
+ # Database credentials from environment variables
4
+ DB_USER=${DB_USER:-"frontend_user"}
5
+ DB_PASSWORD=${DB_PASSWORD:-"hockey-blast"}
6
+ DB_NAME=${DB_NAME:-"hockey_blast_sample"}
7
+ DB_HOST=${DB_HOST:-"localhost"}
8
+ DB_PORT=${DB_PORT:-"5432"}
9
+ COMPRESSED_DUMP_FILE="hockey_blast_sample_backup.sql.gz"
10
+
11
+ # Superuser credentials
12
+ SUPERUSER="your_superuser"
13
+ SUPERUSER_PASSWORD="your_superuser_password"
14
+
15
+ # Export PGPASSWORD to avoid password prompt
16
+ export PGPASSWORD=$SUPERUSER_PASSWORD
17
+
18
+ # Drop the existing database if it exists
19
+ psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --command="SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$DB_NAME' AND pid <> pg_backend_pid();"
20
+ psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --command="DROP DATABASE IF EXISTS $DB_NAME"
21
+
22
+ # Create a new database
23
+ psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --command="CREATE DATABASE $DB_NAME OWNER $SUPERUSER"
24
+
25
+ # Export PGPASSWORD for read-only user
26
+ export PGPASSWORD=$DB_PASSWORD
27
+
28
+ # Restore the database from the dump file with --no-owner option
29
+ gunzip -c $COMPRESSED_DUMP_FILE | pg_restore --username=$DB_USER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --format=custom --no-owner
30
+
31
+ # Grant necessary permissions to the read-only user
32
+ psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --command="GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO frontend_user"
33
+
34
+ echo "Database restore completed: $DB_NAME"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -1,15 +1,17 @@
1
1
  MANIFEST.in
2
2
  README.md
3
3
  setup.py
4
- upload_to_pypi.sh
5
4
  hockey_blast_common_lib/__init__.py
6
5
  hockey_blast_common_lib/aggregate_goalie_stats.py
7
6
  hockey_blast_common_lib/aggregate_human_stats.py
8
7
  hockey_blast_common_lib/aggregate_referee_stats.py
9
8
  hockey_blast_common_lib/aggregate_skater_stats.py
10
9
  hockey_blast_common_lib/db_connection.py
10
+ hockey_blast_common_lib/dump_sample_db.sh
11
+ hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz
11
12
  hockey_blast_common_lib/models.py
12
13
  hockey_blast_common_lib/options.py
14
+ hockey_blast_common_lib/restore_sample_db.sh
13
15
  hockey_blast_common_lib/stats_models.py
14
16
  hockey_blast_common_lib/utils.py
15
17
  hockey_blast_common_lib/wsgi.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='hockey-blast-common-lib', # The name of your package
5
- version='0.1.15',
5
+ version='0.1.16',
6
6
  description='Common library for shared functionality and DB models',
7
7
  author='Pavel Kletskov',
8
8
  author_email='kletskov@gmail.com',
@@ -1,2 +0,0 @@
1
- include *.sh
2
- include *.gz
@@ -1,13 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Remove previous builds
4
- rm -rf dist
5
-
6
- # Build the package
7
- python setup.py sdist bdist_wheel
8
-
9
- # Upload the package to PyPI
10
- twine upload dist/*
11
-
12
- # Clean up
13
- rm -rf dist build *.egg-info