fullscript.spellbook 2.1.5__tar.gz → 2.1.7__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 (42) hide show
  1. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/PKG-INFO +2 -2
  2. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/README.md +1 -1
  3. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/documentation/drive_magic.md +1 -1
  4. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/documentation/sheet_magic.md +4 -4
  5. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/fullscript.spellbook.egg-info/PKG-INFO +2 -2
  6. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/requirements.txt +3 -3
  7. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/drive_magic.py +16 -10
  8. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/sheet_magic.py +4 -4
  9. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/.DS_Store +0 -0
  10. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/.gitignore +0 -0
  11. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/.gitlab-ci.yml +0 -0
  12. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/.python-version +0 -0
  13. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/LICENSE +0 -0
  14. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/MANIFEST.in +0 -0
  15. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/documentation/db_magic.md +0 -0
  16. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/documentation/snowflake_key_pair_setup.md +0 -0
  17. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/documentation/stats_magic.md +0 -0
  18. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/fullscript.spellbook.egg-info/SOURCES.txt +0 -0
  19. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/fullscript.spellbook.egg-info/dependency_links.txt +0 -0
  20. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/fullscript.spellbook.egg-info/requires.txt +0 -0
  21. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/fullscript.spellbook.egg-info/top_level.txt +0 -0
  22. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/pyproject.toml +0 -0
  23. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/setup.cfg +0 -0
  24. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/.DS_Store +0 -0
  25. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/__init__.py +0 -0
  26. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/db_magic.py +0 -0
  27. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/stats_magic.py +0 -0
  28. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/utils.py +0 -0
  29. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/__init__.py +0 -0
  30. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard1.txt +0 -0
  31. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard10.txt +0 -0
  32. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard11.txt +0 -0
  33. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard12.txt +0 -0
  34. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard2.txt +0 -0
  35. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard3.txt +0 -0
  36. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard4.txt +0 -0
  37. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard5.txt +0 -0
  38. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard6.txt +0 -0
  39. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard7.txt +0 -0
  40. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard8.txt +0 -0
  41. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook/wizards/wizard9.txt +0 -0
  42. {fullscript_spellbook-2.1.5 → fullscript_spellbook-2.1.7}/spellbook_config.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fullscript.spellbook
3
- Version: 2.1.5
3
+ Version: 2.1.7
4
4
  Summary: A simple package to make your life easier.
5
5
  Author-email: Thomas Edwards <thomas.edwards@fullscript.com>, Gui Chagas <gui.chagas@fullscript.com>, David King <david.king@fullscript.com>, Meinhard Mare <meinhard.mare@fullscript.com>, Karsten Melchers <karsten.melchers@fullscript.com>
6
6
  License: MIT
@@ -159,7 +159,7 @@ Spellbook requires Python 3.11 or higher. Use the following steps to install:
159
159
  1. Pip install:
160
160
 
161
161
  ```bash
162
- pip install git+https://git.fullscript.io/data/spellbook.git
162
+ pip install fullscript.spellbook
163
163
  ```
164
164
 
165
165
  ## Configuration
@@ -39,7 +39,7 @@ Spellbook requires Python 3.11 or higher. Use the following steps to install:
39
39
  1. Pip install:
40
40
 
41
41
  ```bash
42
- pip install git+https://git.fullscript.io/data/spellbook.git
42
+ pip install fullscript.spellbook
43
43
  ```
44
44
 
45
45
  ## Configuration
@@ -27,7 +27,7 @@ Step-by-step:
27
27
 
28
28
  4 - From the same page, download the client secret as a JSON file.
29
29
 
30
- 5 - Now the process is similar to what is done for `'GS_SERVICE_ACCOUNT'`. Copy the contents of the JSON file.
30
+ 5 - Now the process is similar to what is done for `'GS_SERVICE_ACCOUNT_KEY'`. Copy the contents of the JSON file.
31
31
 
32
32
  6 - Go to the terminal and use `pbpaste | base64 | pbcopy` to paste, encode, and copy the contents again.
33
33
 
@@ -18,8 +18,8 @@
18
18
  ## Create a Google Service account
19
19
  To use this feature, you must create a Google service account. Instructions on how to do this are available on the Google [IAM documentation](https://cloud.google.com/iam/docs/service-accounts-create#iam-service-accounts-create-console)
20
20
 
21
- ## Saving Your `GS_SERVICE_ACCOUNT` Environment Variable
22
- How to save your 'GS_SERVICE_ACCOUNT' env-var to use this code
21
+ ## Saving Your `GS_SERVICE_ACCOUNT_KEY` Environment Variable
22
+ How to save your 'GS_SERVICE_ACCOUNT_KEY' env-var to use this code
23
23
 
24
24
  To use Google Service Account functionality with this code, you need to save your Google Service Account JSON as an encrypted string in an environment variable. Follow these steps:
25
25
  1.Convert the JSON File Content to a Base64-Encoded String
@@ -32,11 +32,11 @@ To use Google Service Account functionality with this code, you need to save you
32
32
 
33
33
  2.Save the Encoded String as an Environment Variable
34
34
  * Add the encoded string as an environment variable.
35
- * Use a name like GS_SERVICE_ACCOUNT for consistency.
35
+ * Use a name like GS_SERVICE_ACCOUNT_KEY for consistency.
36
36
 
37
37
  For example, add the following line to your environment file (e.g., .env):
38
38
  ```bash
39
- GS_SERVICE_ACCOUNT=your_base64_encoded_string
39
+ GS_SERVICE_ACCOUNT_KEY=your_base64_encoded_string
40
40
  ```
41
41
  3.Why Base64 Encoding?
42
42
  * Base64 ensures the JSON content is securely represented as a single string, making it compatible with environment variables.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fullscript.spellbook
3
- Version: 2.1.5
3
+ Version: 2.1.7
4
4
  Summary: A simple package to make your life easier.
5
5
  Author-email: Thomas Edwards <thomas.edwards@fullscript.com>, Gui Chagas <gui.chagas@fullscript.com>, David King <david.king@fullscript.com>, Meinhard Mare <meinhard.mare@fullscript.com>, Karsten Melchers <karsten.melchers@fullscript.com>
6
6
  License: MIT
@@ -159,7 +159,7 @@ Spellbook requires Python 3.11 or higher. Use the following steps to install:
159
159
  1. Pip install:
160
160
 
161
161
  ```bash
162
- pip install git+https://git.fullscript.io/data/spellbook.git
162
+ pip install fullscript.spellbook
163
163
  ```
164
164
 
165
165
  ## Configuration
@@ -183,14 +183,14 @@ six==1.16.0
183
183
  # asttokens
184
184
  # fullscript.spellbook (pyproject.toml)
185
185
  # python-dateutil
186
- snowflake-connector-python==3.15.0
186
+ snowflake-connector-python==4.2.0
187
187
  # via
188
188
  # fullscript.spellbook (pyproject.toml)
189
189
  # snowflake-snowpark-python
190
190
  # snowflake-sqlalchemy
191
- snowflake-snowpark-python==1.25.0
191
+ snowflake-snowpark-python==1.44.0
192
192
  # via fullscript.spellbook (pyproject.toml)
193
- snowflake-sqlalchemy==1.7.0
193
+ snowflake-sqlalchemy==1.8.2
194
194
  # via fullscript.spellbook (pyproject.toml)
195
195
  sortedcontainers==2.4.0
196
196
  # via
@@ -50,22 +50,22 @@ def get_service(scopes, service_account_name, auth_type='service_account', **kwa
50
50
 
51
51
  # Load the configuration
52
52
  config = load_and_parse_config(configurations='google_accounts', **kwargs)
53
- gs_service_account = None
53
+ GS_SERVICE_ACCOUNT_KEY = None
54
54
 
55
55
  # Find the Google Sheets service account details in the configuration
56
56
  google_accounts = config.get('google_accounts', [])
57
57
  for gs_account in google_accounts:
58
58
  if gs_account.get('name') == service_account_name:
59
- gs_service_account = gs_account.get('service_account')
59
+ GS_SERVICE_ACCOUNT_KEY = gs_account.get('service_account')
60
60
  break
61
61
 
62
- if not gs_service_account:
62
+ if not GS_SERVICE_ACCOUNT_KEY:
63
63
  raise ValueError(
64
64
  f"Google Sheets service account '{service_account_name}' not found in configuration file.")
65
65
 
66
- # creates a credentials file using the info in the env var GS_SERVICE_ACCOUNT
66
+ # creates a credentials file using the info in the env var GS_SERVICE_ACCOUNT_KEY
67
67
  with open('credentials.json', 'w') as credential_file:
68
- print(base64.b64decode(os.environ['GS_SERVICE_ACCOUNT']).decode(), file=credential_file)
68
+ print(base64.b64decode(os.environ['GS_SERVICE_ACCOUNT_KEY']).decode(), file=credential_file)
69
69
 
70
70
  # uses the file to create the scoped credentials
71
71
  credentials = service_account.Credentials.from_service_account_file('credentials.json')
@@ -140,17 +140,23 @@ def list_folder_contents(service, folder_url, max_results=1000, show_trashed=Fal
140
140
 
141
141
  # get the folder id
142
142
  folder_id = folder_url.rsplit('/', 1)[-1]
143
-
144
143
  try:
145
- # get items from GDrive
144
+ # get files from GDrive
145
+ files = []
146
+
146
147
  results = service.files().list(q=f"'{folder_id}' in parents and trashed = {str(show_trashed).lower()}",
147
148
  pageSize=max_results, orderBy='name',
148
149
  includeItemsFromAllDrives=True, supportsAllDrives=True,
149
- fields="nextPageToken, files(id, name, mimeType, size, parents, modifiedTime)").execute()
150
- items = results.get('files', [])
150
+ fields="nextPageToken, files(id, name, mimeType, size, parents, modifiedTime)")
151
151
 
152
+ while results is not None:
153
+ response = results.execute()
154
+ files.extend(response.get('files', []))
155
+ results = service.files().list_next(results, response)
156
+
152
157
  # returns as a DF
153
- df_temp = pd.DataFrame(items)
158
+ df_temp = pd.DataFrame(files)
159
+
154
160
  df_temp = df_temp.rename({'size': 'size_bytes'}, axis=1)
155
161
  return df_temp
156
162
  except HttpError as error:
@@ -37,21 +37,21 @@ class GSheetsHandler:
37
37
  try:
38
38
  # Load the configuration
39
39
  config = load_and_parse_config(config_file_path=self._config_file, configurations='google_accounts')
40
- gs_service_account = None
40
+ GS_SERVICE_ACCOUNT_KEY = None
41
41
 
42
42
  # Find the Google Sheets service account details in the configuration
43
43
  google_accounts = config.get('google_accounts', [])
44
44
  for gs_account in google_accounts:
45
45
  if gs_account.get('name') == self._service_account_name:
46
- gs_service_account = gs_account.get('service_account')
46
+ GS_SERVICE_ACCOUNT_KEY = gs_account.get('service_account')
47
47
  break
48
48
 
49
- if not gs_service_account:
49
+ if not GS_SERVICE_ACCOUNT_KEY:
50
50
  raise ValueError(f"Google Sheets service account '{self._service_account_name}' not found in configuration file.")
51
51
 
52
52
  # Decode and write credentials from configuration to a temporary file
53
53
  with open("credentials.json", "w") as credential_file:
54
- print(base64.b64decode(gs_service_account).decode(), file=credential_file)
54
+ print(base64.b64decode(GS_SERVICE_ACCOUNT_KEY).decode(), file=credential_file)
55
55
 
56
56
  # Use the JSON file to authenticate on Google Sheets
57
57
  self._gc = pygsheets.authorize(service_file="credentials.json")