SDG/Config/IronPython.File Reader.xml
<?xml version="1.0" encoding="Windows-1252"?><generators><generator type="RedGate.SQLDataGenerator.ExpressionGenerators.Python.PythonScriptGenerator" name="US City" description="New York, Los Angeles, Chicago... (using IronPython)" category="Geographical">
<property name="Code"># Open a file and filter the results filename = r"cities.txt" def main(config): filepath = config["config_path"] + "\\" + filename return list(cities(filepath)) def cities(filepath): with open(filepath) as cities: for city in cities: if city.startswith(tuple("ABDCEFG")): yield city.strip() </property> <property name="ColumnType">nvarchar</property> <type sqlType="NVarchar" type="String" /> </generator> </generators> |