zepben.ewb 1.0.0b4__py3-none-any.whl → 1.0.0b6__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.
Files changed (127) hide show
  1. zepben/ewb/__init__.py +1 -1
  2. zepben/ewb/database/sql/__init__.py +4 -0
  3. zepben/ewb/database/{sqlite/tables → sql}/column.py +1 -1
  4. zepben/ewb/database/sql/sql_table.py +142 -0
  5. zepben/ewb/database/sqlite/tables/associations/table_asset_organisation_roles_assets.py +1 -1
  6. zepben/ewb/database/sqlite/tables/associations/table_assets_power_system_resources.py +1 -1
  7. zepben/ewb/database/sqlite/tables/associations/table_battery_units_battery_controls.py +1 -1
  8. zepben/ewb/database/sqlite/tables/associations/table_circuits_substations.py +1 -1
  9. zepben/ewb/database/sqlite/tables/associations/table_circuits_terminals.py +1 -1
  10. zepben/ewb/database/sqlite/tables/associations/table_customer_agreements_pricing_structures.py +1 -1
  11. zepben/ewb/database/sqlite/tables/associations/table_end_devices_end_device_functions.py +1 -1
  12. zepben/ewb/database/sqlite/tables/associations/table_equipment_equipment_containers.py +1 -1
  13. zepben/ewb/database/sqlite/tables/associations/table_equipment_operational_restrictions.py +1 -1
  14. zepben/ewb/database/sqlite/tables/associations/table_equipment_usage_points.py +1 -1
  15. zepben/ewb/database/sqlite/tables/associations/table_loops_substations.py +1 -1
  16. zepben/ewb/database/sqlite/tables/associations/table_pricing_structures_tariffs.py +1 -1
  17. zepben/ewb/database/sqlite/tables/associations/table_protection_relay_functions_protected_switches.py +1 -1
  18. zepben/ewb/database/sqlite/tables/associations/table_protection_relay_functions_sensors.py +1 -1
  19. zepben/ewb/database/sqlite/tables/associations/table_protection_relay_schemes_protection_relay_functions.py +1 -1
  20. zepben/ewb/database/sqlite/tables/associations/table_usage_points_end_devices.py +1 -1
  21. zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/table_reclose_delays.py +1 -1
  22. zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/table_relay_info.py +1 -1
  23. zepben/ewb/database/sqlite/tables/extensions/iec61968/metering/table_pan_demand_response_functions.py +1 -1
  24. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/table_lv_feeders.py +1 -1
  25. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_distance_relays.py +1 -1
  26. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_function_thresholds.py +1 -1
  27. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_function_time_limits.py +1 -1
  28. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_functions.py +1 -1
  29. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_schemes.py +1 -1
  30. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_systems.py +1 -1
  31. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/table_battery_controls.py +1 -1
  32. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/table_power_transformer_end_ratings.py +1 -1
  33. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_no_load_tests.py +1 -1
  34. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_open_circuit_tests.py +1 -1
  35. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_short_circuit_tests.py +1 -1
  36. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_shunt_compensator_info.py +1 -1
  37. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_switch_info.py +1 -1
  38. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_end_info.py +1 -1
  39. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_tank_info.py +1 -1
  40. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_test.py +1 -1
  41. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_wire_info.py +1 -1
  42. zepben/ewb/database/sqlite/tables/iec61968/assets/table_assets.py +1 -1
  43. zepben/ewb/database/sqlite/tables/iec61968/assets/table_streetlights.py +1 -1
  44. zepben/ewb/database/sqlite/tables/iec61968/common/table_documents.py +1 -1
  45. zepben/ewb/database/sqlite/tables/iec61968/common/table_location_street_addresses.py +1 -1
  46. zepben/ewb/database/sqlite/tables/iec61968/common/table_organisation_roles.py +1 -1
  47. zepben/ewb/database/sqlite/tables/iec61968/common/table_position_points.py +1 -1
  48. zepben/ewb/database/sqlite/tables/iec61968/common/table_street_addresses.py +1 -1
  49. zepben/ewb/database/sqlite/tables/iec61968/common/table_town_details.py +1 -1
  50. zepben/ewb/database/sqlite/tables/iec61968/customers/table_customer_agreements.py +1 -1
  51. zepben/ewb/database/sqlite/tables/iec61968/customers/table_customers.py +1 -1
  52. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/table_current_transformer_info.py +1 -1
  53. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/table_potential_transformer_info.py +1 -1
  54. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassets/table_poles.py +1 -1
  55. zepben/ewb/database/sqlite/tables/iec61968/metering/table_end_device_functions.py +1 -1
  56. zepben/ewb/database/sqlite/tables/iec61968/metering/table_end_devices.py +1 -1
  57. zepben/ewb/database/sqlite/tables/iec61968/metering/table_usage_points.py +1 -1
  58. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_auxiliary_equipment.py +1 -1
  59. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_current_transformers.py +1 -1
  60. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_potential_transformers.py +1 -1
  61. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_base_voltages.py +1 -1
  62. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_conducting_equipment.py +1 -1
  63. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_curve_data.py +1 -1
  64. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_equipment.py +1 -1
  65. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_feeders.py +1 -1
  66. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_identified_objects.py +1 -1
  67. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_name_types.py +1 -1
  68. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_names.py +1 -1
  69. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_power_system_resources.py +1 -1
  70. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_sub_geographical_regions.py +1 -1
  71. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_substations.py +1 -1
  72. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_terminals.py +1 -1
  73. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagram_object_points.py +1 -1
  74. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagram_objects.py +1 -1
  75. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagrams.py +1 -1
  76. zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/table_equivalent_branches.py +1 -1
  77. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_battery_units.py +1 -1
  78. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_power_electronics_units.py +1 -1
  79. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_analogs.py +1 -1
  80. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_controls.py +1 -1
  81. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_measurements.py +1 -1
  82. zepben/ewb/database/sqlite/tables/iec61970/base/protection/table_current_relays.py +1 -1
  83. zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_controls.py +1 -1
  84. zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_sources.py +1 -1
  85. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ac_line_segments.py +1 -1
  86. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_breakers.py +1 -1
  87. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_clamps.py +1 -1
  88. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_conductors.py +1 -1
  89. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_cuts.py +1 -1
  90. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_earth_fault_compensators.py +1 -1
  91. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumer_phases.py +1 -1
  92. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumers.py +1 -1
  93. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_source_phases.py +1 -1
  94. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_sources.py +1 -1
  95. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_fuses.py +1 -1
  96. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_grounding_impedances.py +1 -1
  97. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_linear_shunt_compensators.py +1 -1
  98. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_sequence_impedances.py +1 -1
  99. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_petersen_coils.py +1 -1
  100. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_phase_impedance_data.py +1 -1
  101. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_electronics_connection_phases.py +1 -1
  102. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_electronics_connections.py +1 -1
  103. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_transformer_ends.py +1 -1
  104. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_transformers.py +1 -1
  105. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_protected_switches.py +1 -1
  106. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ratio_tap_changers.py +1 -1
  107. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_cond_eq.py +1 -1
  108. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_controls.py +1 -1
  109. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_rotating_machines.py +1 -1
  110. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_series_compensators.py +1 -1
  111. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_shunt_compensators.py +1 -1
  112. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_static_var_compensator.py +1 -1
  113. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_switches.py +1 -1
  114. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_synchronous_machines.py +1 -1
  115. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changer_controls.py +1 -1
  116. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changers.py +1 -1
  117. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_ends.py +1 -1
  118. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_star_impedances.py +1 -1
  119. zepben/ewb/database/sqlite/tables/iec61970/infiec61970/feeder/table_circuits.py +1 -1
  120. zepben/ewb/database/sqlite/tables/sqlite_table.py +21 -118
  121. zepben/ewb/database/sqlite/tables/table_metadata_data_sources.py +1 -1
  122. zepben/ewb/database/sqlite/tables/table_version.py +2 -1
  123. {zepben_ewb-1.0.0b4.dist-info → zepben_ewb-1.0.0b6.dist-info}/METADATA +13 -24
  124. {zepben_ewb-1.0.0b4.dist-info → zepben_ewb-1.0.0b6.dist-info}/RECORD +127 -125
  125. {zepben_ewb-1.0.0b4.dist-info → zepben_ewb-1.0.0b6.dist-info}/WHEEL +0 -0
  126. {zepben_ewb-1.0.0b4.dist-info → zepben_ewb-1.0.0b6.dist-info}/licenses/LICENSE +0 -0
  127. {zepben_ewb-1.0.0b4.dist-info → zepben_ewb-1.0.0b6.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@
6
6
  __all__ = ["TableStaticVarCompensators"]
7
7
 
8
8
  from zepben.ewb import TableRegulatingCondEq
9
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
9
+ from zepben.ewb.database.sql.column import Column, Nullable
10
10
 
11
11
 
12
12
  class TableStaticVarCompensators(TableRegulatingCondEq):
@@ -7,7 +7,7 @@ __all__ = ["TableSwitches"]
7
7
 
8
8
  from abc import ABC
9
9
 
10
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
10
+ from zepben.ewb.database.sql.column import Column, Nullable
11
11
  from zepben.ewb.database.sqlite.tables.iec61970.base.core.table_conducting_equipment import TableConductingEquipment
12
12
 
13
13
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  __all__ = ["TableSynchronousMachines"]
7
7
 
8
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
8
+ from zepben.ewb.database.sql.column import Column, Nullable
9
9
  from zepben.ewb.database.sqlite.tables.iec61970.base.wires.table_rotating_machines import TableRotatingMachines
10
10
 
11
11
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  __all__ = ["TableTapChangerControls"]
7
7
 
8
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
8
+ from zepben.ewb.database.sql.column import Column, Nullable
9
9
  from zepben.ewb.database.sqlite.tables.iec61970.base.wires.table_regulating_controls import TableRegulatingControls
10
10
 
11
11
 
@@ -7,7 +7,7 @@ __all__ = ["TableTapChangers"]
7
7
 
8
8
  from abc import ABC
9
9
 
10
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
10
+ from zepben.ewb.database.sql.column import Column, Nullable
11
11
  from zepben.ewb.database.sqlite.tables.iec61970.base.core.table_power_system_resources import TablePowerSystemResources
12
12
 
13
13
 
@@ -8,7 +8,7 @@ __all__ = ["TableTransformerEnds"]
8
8
  from abc import ABC
9
9
  from typing import List, Generator
10
10
 
11
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
11
+ from zepben.ewb.database.sql.column import Column, Nullable
12
12
  from zepben.ewb.database.sqlite.tables.iec61970.base.core.table_identified_objects import TableIdentifiedObjects
13
13
 
14
14
 
@@ -7,7 +7,7 @@ __all__ = ["TableTransformerStarImpedances"]
7
7
 
8
8
  from typing import List, Generator
9
9
 
10
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
10
+ from zepben.ewb.database.sql.column import Column, Nullable
11
11
  from zepben.ewb.database.sqlite.tables.iec61970.base.core.table_identified_objects import TableIdentifiedObjects
12
12
 
13
13
 
@@ -7,7 +7,7 @@ __all__ = ["TableCircuits"]
7
7
 
8
8
  from typing import List, Generator
9
9
 
10
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
10
+ from zepben.ewb.database.sql.column import Column, Nullable
11
11
  from zepben.ewb.database.sqlite.tables.iec61970.base.wires.table_lines import TableLines
12
12
 
13
13
 
@@ -7,136 +7,39 @@ from __future__ import annotations
7
7
 
8
8
  __all__ = ["SqliteTable"]
9
9
 
10
- from abc import abstractmethod
11
- from typing import List, Optional, Type, Any, Generator
10
+ from abc import ABC
11
+ from typing import List, Generator
12
12
 
13
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
13
+ from zepben.ewb.database.sql.column import Column
14
+ from zepben.ewb.database.sql.sql_table import SqlTable
14
15
 
15
16
 
16
- # @dataclass(slots=True)
17
- class SqliteTable(object):
17
+ class SqliteTable(SqlTable, ABC):
18
18
  """
19
- Represents a table in an Sqlite Database. This class should be extended and initialised to build the DDL for a Table.
20
- Methods that need to be overridden are those marked @abstractmethod.
21
- Methods that can be optionally overridden are unique_index_columns() and non_unique_index_columns().
22
- Columns must be assigned in __init__ and column_index must be incremented for each Column created.
23
- See existing implementations such as TableVersion for examples.
19
+ Represents a table in an Sqlite Database.
24
20
  """
25
21
 
26
- column_index: int = 0
27
- """Used to specify index of the column in the table during initialisation. Always increment BEFORE creating a Column. Indices start from 1."""
28
-
29
- _column_set: Optional[List[Column]] = None
30
- _create_table_sql: Optional[str] = None
31
- _prepared_insert_sql: Optional[str] = None
32
- _prepared_update_sql: Optional[str] = None
33
- _create_indexes_sql: Optional[List[str]] = None
34
- _select_sql: Optional[str] = None
35
-
36
- @property
37
- @abstractmethod
38
- def name(self) -> str:
39
- pass
40
-
41
- #
42
- # NOTE: This function is called `description` in teh JVM SDK, but in the python SDK this
43
- # conflicts with the `description` column of `TableIdentifiedObjects`.
44
- #
45
- def describe(self) -> str:
46
- return self.name.replace("_", " ")
47
-
48
22
  @property
49
23
  def create_table_sql(self):
50
- return self._create_table_sql if self._create_table_sql else self._build_create_table_sql()
51
-
52
- @property
53
- def prepared_insert_sql(self):
54
- return self._prepared_insert_sql if self._prepared_insert_sql else self._build_prepared_insert_sql()
24
+ if self._create_table_sql is None:
25
+ self._create_table_sql = self._build_create_table_sql()
26
+ return self._create_table_sql
55
27
 
56
28
  @property
57
29
  def create_indexes_sql(self):
58
- return self._create_indexes_sql if self._create_indexes_sql else self._build_indexes_sql()
59
-
60
- @property
61
- def select_sql(self):
62
- return self._select_sql if self._select_sql else self._build_select_sql()
63
-
64
- @property
65
- def prepared_update_sql(self):
66
- return self._prepared_update_sql if self._prepared_update_sql else self._build_prepared_update_sql()
67
-
68
- @property
69
- def unique_index_columns(self) -> Generator[List[Column], None, None]:
70
- # To make this a generator we need to `yield`, but we have nothing to yield by default, so trick it by yielding from an empty for-loop.
71
- for it in []:
72
- yield it
73
-
74
- @property
75
- def non_unique_index_columns(self) -> Generator[List[Column], None, None]:
76
- # To make this a generator we need to `yield`, but we have nothing to yield by default, so trick it by yielding from an empty for-loop.
77
- for it in []:
78
- yield it
79
-
80
- @property
81
- def column_set(self) -> List[Column]:
82
- return self._column_set if self._column_set else self._build_column_set(self.__class__, self)
83
-
84
- def _build_column_set(self, clazz: Type[Any], instance: SqliteTable) -> List[Column]:
85
- """
86
- Builds the list of columns for use in DDL statements for this table.
87
-
88
- :param clazz: The class of this table.
89
- :param instance:
90
- :return:
91
- """
92
- cols = list()
93
- for field, x in instance.__dict__.items():
94
- if isinstance(x, Column):
95
- if x.query_index != len(cols) + 1:
96
- raise ValueError(
97
- f"Field {field} in SQL Table class {clazz.__name__} is using an invalid column index. "
98
- f"Did you forget to increment column_index, or did you skip one?"
99
- )
100
- cols.append(x)
101
-
102
- if len(set([c.name for c in cols])) != len(cols):
103
- raise ValueError("You have a duplicate column names, go fix that.")
104
-
105
- self._column_set = sorted(cols, key=lambda it: it.query_index)
106
- return self._column_set
107
-
108
- def _build_create_table_sql(self) -> str:
109
- self._create_table_sql = f"CREATE TABLE {self.name} ({', '.join([str(c) for c in self.column_set])})"
110
- return self._create_table_sql
111
-
112
- def _build_prepared_insert_sql(self) -> str:
113
- self._prepared_insert_sql = f"INSERT INTO {self.name} ({', '.join([c.name for c in self.column_set])}) " \
114
- f"VALUES ({', '.join(['?' for _ in self.column_set])})"
115
- return self._prepared_insert_sql
116
-
117
- def _build_indexes_sql(self) -> List[str]:
118
- statements = []
119
- for index_col in self.unique_index_columns:
120
- statements.append(self._build_index_sql(index_col, True))
121
- for index_col in self.non_unique_index_columns:
122
- statements.append(self._build_index_sql(index_col, False))
123
- self._create_indexes_sql = statements
30
+ if self._create_indexes_sql is None:
31
+ self._create_indexes_sql = list(self._build_indexes_sql())
124
32
  return self._create_indexes_sql
125
33
 
126
- def _build_index_sql(self, index_col: List[Column], is_unique: bool):
127
- id_string = f"{self.name}_{'_'.join(map(lambda c: c.name, index_col))}"
128
- col_string = ', '.join(map(lambda c: c.name, index_col))
129
- return f"CREATE {'UNIQUE ' if is_unique else ''}INDEX {id_string} ON {self.name} ({col_string})"
130
-
131
- def _build_select_sql(self) -> str:
132
- self._select_sql = f"SELECT {', '.join([c.name for c in self.column_set])} FROM {self.name}"
133
- return self._select_sql
34
+ def _build_create_table_sql(self) -> str:
35
+ return f"CREATE TABLE {self.name} ({', '.join(str(c) for c in self.column_set)})"
134
36
 
135
- def _build_prepared_update_sql(self) -> str:
136
- self._prepared_update_sql = f"UPDATE {self.name} SET {', '.join([f'{c.name} = ?' for c in self.column_set])}"
137
- return self._prepared_update_sql
37
+ def _build_indexes_sql(self) -> Generator[str, None, None]:
38
+ yield from (self._build_index_sql(index_col, True) for index_col in self.unique_index_columns)
39
+ yield from (self._build_index_sql(index_col, False) for index_col in self.non_unique_index_columns)
138
40
 
139
- def _create_column(self, name: str, type_: str, nullable: Nullable = Nullable.NONE) -> Column:
140
- self.column_index += 1
141
- # noinspection PyArgumentList
142
- return Column(self.column_index, name, type_, nullable)
41
+ def _build_index_sql(self, index_col: List[Column], is_unique: bool) -> str:
42
+ index_col_names = [c.name for c in index_col]
43
+ return (f"CREATE {'UNIQUE ' if is_unique else ''}INDEX "
44
+ f"{self.name}_{'_'.join(index_col_names)}" # id string
45
+ f" ON {self.name} ({', '.join(index_col_names)})") # col string
@@ -5,7 +5,7 @@
5
5
 
6
6
  __all__ = ["TableMetadataDataSources"]
7
7
 
8
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
8
+ from zepben.ewb.database.sql.column import Column, Nullable
9
9
  from zepben.ewb.database.sqlite.tables.sqlite_table import SqliteTable
10
10
 
11
11
 
@@ -9,7 +9,7 @@ import sqlite3
9
9
  from sqlite3 import Cursor
10
10
  from typing import Optional
11
11
 
12
- from zepben.ewb.database.sqlite.tables.column import Column, Nullable
12
+ from zepben.ewb.database.sql.column import Column, Nullable
13
13
  from zepben.ewb.database.sqlite.tables.sqlite_table import SqliteTable
14
14
 
15
15
 
@@ -17,6 +17,7 @@ class TableVersion(SqliteTable):
17
17
  SUPPORTED_VERSION = 59
18
18
 
19
19
  def __init__(self):
20
+ super().__init__()
20
21
  self.version: Column = self._create_column("version", "TEXT", Nullable.NOT_NULL)
21
22
 
22
23
  @property
@@ -1,49 +1,38 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zepben.ewb
3
- Version: 1.0.0b4
3
+ Version: 1.0.0b6
4
4
  Summary: Python SDK for interacting with the Energy Workbench platform
5
- Home-page: https://github.com/zepben/evolve-sdk-python
6
- Author: Kurt Greaves
7
- Author-email: kurt.greaves@zepben.com
8
- License: MPL 2.0
9
- Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
5
+ Author-email: Kurt Greaves <kurt.greaves@zepben.com>, Max Chesterfield <max.chesterfield@zepben.com>
6
+ License-Expression: MPL-2.0
7
+ Project-URL: Repository, https://github.com/zepben/evolve-sdk-python
8
+ Project-URL: Homepage, https://zepben.com
10
9
  Classifier: Programming Language :: Python :: 3
11
10
  Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Operating System :: OS Independent
15
- Requires-Python: >=3.9,<3.13
15
+ Requires-Python: <3.13,>=3.9
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: zepben-protobuf==1.0.0b1
18
+ Requires-Dist: zepben.protobuf==1.0.0b1
19
19
  Requires-Dist: typing_extensions==4.12.2
20
20
  Requires-Dist: requests<3.0.0,>=2.26.0
21
21
  Requires-Dist: urllib3<1.27.0,>=1.26.6
22
22
  Requires-Dist: PyJWT<2.2.0,>=2.1.0
23
23
  Requires-Dist: dataclassy==0.6.2
24
24
  Provides-Extra: test
25
- Requires-Dist: pytest==7.1.2; extra == "test"
26
- Requires-Dist: pytest-cov==2.10.1; extra == "test"
27
- Requires-Dist: pytest-asyncio==0.19.0; extra == "test"
28
- Requires-Dist: pytest-timeout==1.4.2; extra == "test"
25
+ Requires-Dist: pytest<9,>=7.4.4; extra == "test"
26
+ Requires-Dist: pytest-cov==6.1.1; extra == "test"
27
+ Requires-Dist: pytest-asyncio==0.26.0; extra == "test"
28
+ Requires-Dist: pytest-timeout==2.4.0; extra == "test"
29
29
  Requires-Dist: pytest-subtests; extra == "test"
30
- Requires-Dist: hypothesis==6.56.3; extra == "test"
30
+ Requires-Dist: hypothesis==6.119.4; extra == "test"
31
31
  Requires-Dist: grpcio-testing==1.61.3; extra == "test"
32
32
  Requires-Dist: pylint==2.14.5; extra == "test"
33
33
  Requires-Dist: six==1.16.0; extra == "test"
34
34
  Requires-Dist: tox; extra == "test"
35
- Dynamic: author
36
- Dynamic: author-email
37
- Dynamic: classifier
38
- Dynamic: description
39
- Dynamic: description-content-type
40
- Dynamic: home-page
41
- Dynamic: license
42
35
  Dynamic: license-file
43
- Dynamic: provides-extra
44
- Dynamic: requires-dist
45
- Dynamic: requires-python
46
- Dynamic: summary
47
36
 
48
37
  ![Build Status](https://img.shields.io/github/actions/workflow/status/zepben/evolve-sdk-python/python-lib-snapshot.yml)
49
38
  [![codecov](https://codecov.io/gh/zepben/evolve-sdk-python/branch/main/graph/badge.svg?token=B0WNRMMR77)](https://codecov.io/gh/zepben/evolve-sdk-python)