Skip to content

Commit 40974fb

Browse files
committed
Merge 0.7
2 parents 8929d05 + 3bb04bf commit 40974fb

File tree

14 files changed

+130
-20
lines changed

14 files changed

+130
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Handle deletion in progress with status updates
2525
- Add postprocess in Template
2626
- Remove the dependencies property from `Component`
27+
- Fix the bug where the parent of dependent_tables was incorrect when deleting a component.
2728

2829
### New features
2930

3031
- Add pydantic schema support
3132
- Add recursive error propagation
3233
- Add reconnection support for Snowflake vector search
33-
- Add scanning for leaked passwords on the CI
34+
- Add scanning for leaked passwords on the CI
3435
- Simple detached-lifetime compute and vector-search implementations
3536

3637
### Bug fixes

plugins/snowflake/superduper_snowflake/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from .secrets import check_secret_updates, raise_if_secrets_pending, secrets_not_ready
33
from .vector_search import SnowflakeVectorSearcher as VectorSearcher
44

5-
__version__ = "0.7.0"
5+
__version__ = "0.7.4"
6+
67

78
__all__ = [
89
"VectorSearcher",

plugins/snowflake/superduper_snowflake/data_backend.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ def drop(self, force: bool = False):
181181

182182
def list_tables(self):
183183
"""List all tables or collections in the database."""
184-
results = self.session.sql("SHOW TABLES").collect()
185-
return [r.name for r in results]
184+
results_tables = self.session.sql("SHOW TABLES").collect()
185+
results_views = self.session.sql("SHOW VIEWS").collect()
186+
return [r.name for r in results_tables] + [r.name for r in results_views]
186187

187188
########################################################
188189
# Abstract methods/ optional methods to be implemented #

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
name = "superduper-framework"
77
description = "Build compositional and declarative AI applications and agents"
88
readme = "README.md"
9-
version = '0.7.0'
9+
version = '0.7.3'
1010
license = {file = "LICENSE"}
1111
maintainers = [{name = "superduper.io, Inc.", email = "[email protected]"}]
1212
keywords = [
@@ -70,7 +70,7 @@ test = [
7070
"pre-commit",
7171
"black==25.1.0",
7272
"ruff==0.4.4",
73-
"mypy",
73+
"mypy==1.15.0",
7474
"types-PyYAML",
7575
"types-requests",
7676
"interrogate",

superduper/base/base.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,22 @@ def encode(
272272
for k, v in kwargs.items():
273273
setattr(context, k, v)
274274

275-
r = self.dict()
275+
if context.keep_variables:
276+
r = self._original_parameters
277+
else:
278+
r = self.dict()
279+
280+
if not context.include_defaults:
281+
for k, v in list(r.items()):
282+
if not v:
283+
del r[k]
284+
if 'details' in r:
285+
del r['details']
286+
if 'status' in r:
287+
del r['status']
288+
if 'version' in r:
289+
del r['version']
290+
276291
r = self.class_schema.encode_data(r, context=context)
277292

278293
def _replace_loads_with_references(record, lookup):

superduper/base/datalayer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,14 @@ def _build_remove(
486486
)
487487
)
488488
for table in object.dependent_tables:
489+
table_parents = self.metadata.get_component_parents(
490+
component='Table', identifier=table
491+
)
489492
events.append(
490493
Delete(
491494
component='Table',
492495
identifier=table,
493-
parents=[':'.join(p) for p in parents],
496+
parents=[':'.join(p) for p in table_parents],
494497
)
495498
)
496499

superduper/base/datatype.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,24 @@ def encode_data(self, item, context):
121121
context.builds[key] = item
122122
return '?' + key
123123

124-
r = item.dict()
124+
if context.keep_variables:
125+
r = item._original_parameters
126+
else:
127+
r = item.dict()
128+
129+
if not context.include_defaults:
130+
from superduper.base.document import Document
131+
132+
for k, v in list(r.items()):
133+
if not v:
134+
del r[k]
135+
if 'status' in r:
136+
del r['status']
137+
if 'details' in r:
138+
del r['details']
139+
if 'version' in r:
140+
del r['version']
141+
125142
if r.schema:
126143
r = dict(r.schema.encode_data(r, context))
127144
else:

superduper/base/encoding.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class EncodeContext:
2222
:param metadata: Whether to include metadata.
2323
:param defaults: Whether to include defaults.
2424
:param cfg: Configuration object.
25+
:param keep_variables: Whether to keep variables.
26+
:param include_defaults: Whether to include default values.
2527
"""
2628

2729
name: str = '__main__'
@@ -33,6 +35,8 @@ class EncodeContext:
3335
metadata: bool = True
3436
defaults: bool = True
3537
cfg: t.Optional[Config] = None
38+
keep_variables: bool = False
39+
include_defaults: bool = True
3640

3741
def __call__(self, name: str):
3842
return EncodeContext(
@@ -44,5 +48,7 @@ def __call__(self, name: str):
4448
leaves_to_keep=self.leaves_to_keep,
4549
metadata=self.metadata,
4650
defaults=self.defaults,
51+
keep_variables=self.keep_variables,
52+
include_defaults=self.include_defaults,
4753
cfg=self.cfg,
4854
)

superduper/base/metadata.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ def set_failed(self, db: 'Datalayer', reason: str, message: str | None = None):
227227
for idep in self.inverse_dependencies:
228228
logging.info(f'Setting downstream job {idep} status to failed')
229229
job = db['Job'].get(job_id=idep, decode=True)
230+
if job is None:
231+
continue
232+
230233
job.set_failed(
231234
db, reason=f"Upstream dependency {self.job_id} failed", message=None
232235
)

superduper/base/schema.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ def encode_data(self, out, context: t.Optional[EncodeContext] = None, **kwargs):
192192

193193
assert field is not None
194194

195-
# TODO
196-
# field.validate(out[k])
197-
198195
try:
199196
encoded = field.encode_data(
200197
out[k],

0 commit comments

Comments
 (0)