relationalai 0.12.0__py3-none-any.whl → 0.12.2__py3-none-any.whl

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.
@@ -102,6 +102,7 @@ def _get_export_reads(export_ids: list[tuple[lqp.RelationId, int, lqp.Type]]) ->
102
102
  data_columns=csv_columns,
103
103
  compression="gzip",
104
104
  partition_size=200,
105
+ syntax_escapechar='"', # To follow Snowflake's expected format
105
106
  meta=None,
106
107
  )
107
108
  reads.append(lqp.Read(read_type=lqp.Export(config=export_csv_config, meta=None), meta=None))
@@ -579,8 +580,9 @@ def get_relation_id(ctx: TranslationCtx, relation: ir.Relation, projection: list
579
580
  if relation.id in ctx.def_names.id_to_name:
580
581
  unique_name = ctx.def_names.id_to_name[relation.id]
581
582
  else:
582
- prefix = helpers.relation_name_prefix(relation)
583
- unique_name = ctx.def_names.get_name_by_id(relation.id, prefix + relation.name)
583
+ name = helpers.relation_name_prefix(relation) + relation.name
584
+ name = helpers.sanitize(name)
585
+ unique_name = ctx.def_names.get_name_by_id(relation.id, name)
584
586
 
585
587
  return utils.gen_rel_id(ctx, unique_name, types)
586
588
 
@@ -56,5 +56,6 @@ class Executor():
56
56
  rich.print(f"[black]{df}[/black]")
57
57
  if not df.empty:
58
58
  for col in extra_cols:
59
- df = df.drop(col, axis=1)
59
+ if col in df.columns:
60
+ df = df.drop(col, axis=1)
60
61
  return df
@@ -558,22 +558,23 @@ class Flatten(Pass):
558
558
  def rewrite_wide_output(self, output: ir.Output):
559
559
  assert(output.keys)
560
560
 
561
- # only prefix keys that are not already in the output
562
- prefix_keys = []
561
+ # only append keys that are not already in the output
562
+ suffix_keys = []
563
563
  for key in output.keys:
564
564
  if all([val is not key for _, val in output.aliases]):
565
- prefix_keys.append(key)
565
+ suffix_keys.append(key)
566
566
 
567
567
  aliases: OrderedSet[Tuple[str, ir.Value]] = ordered_set()
568
- # add the keys to the output
569
- for key in prefix_keys:
570
- aliases.add((key.name, key))
571
568
 
572
569
  # add the remaining args, unless it is already a key
573
570
  for name, val in output.aliases:
574
- if not isinstance(val, ir.Var) or val not in prefix_keys:
571
+ if not isinstance(val, ir.Var) or val not in suffix_keys:
575
572
  aliases.add((name, val))
576
573
 
574
+ # add the keys to the output
575
+ for key in suffix_keys:
576
+ aliases.add((key.name, key))
577
+
577
578
  # TODO - we are assuming that the Rel compiler will translate nullable lookups
578
579
  # properly, returning a `Missing` if necessary, like this:
579
580
  # (nested_192(_adult, _adult_name) or (not nested_192(_adult, _) and _adult_name = Missing)) and