code stringlengths 1 18.2k |
|---|
def partition(self, ref=None, **kwargs): """Return a partition in this bundle for a vid reference or name parts""" from ambry.orm.exc import NotFoundError from sqlalchemy.orm.exc import NoResultFound if not ref and not kwargs: return None if ref: for p in self.partitions: if ref == p.name or ref == p.vname or ref == p.... |
def partition_by_vid(self, ref): """A much faster way to get partitions, by vid only""" from ambry.orm import Partition p = self.session.query(Partition).filter(Partition.vid == str(ref)).first() if p: return self.wrap_partition(p) else: return None |
def tables(self): """ Return a iterator of tables in this bundle :return: """ from ambry.orm import Table from sqlalchemy.orm import lazyload return (self.dataset.session.query(Table) .filter(Table.d_vid == self.dataset.vid) .options(lazyload('*')) .all()) |
def new_table(self, name, add_id=True, **kwargs): """ Create a new table, if it does not exist, or update an existing table if it does :param name: Table name :param add_id: If True, add an id field ( default is True ) :param kwargs: Other options passed to table object :return: """ return self.dataset.new_table(name=n... |
def sources(self): """Iterate over downloadable sources""" def set_bundle(s): s._bundle = self return s return list(set_bundle(s) for s in self.dataset.sources) |
def _resolve_sources(self, sources, tables, stage=None, predicate=None): """ Determine what sources to run from an input of sources and tables :param sources: A collection of source objects, source names, or source vids :param tables: A collection of table names :param stage: If not None, select only sources from this ... |
s in sources if predicate(s)] if stage: sources = [s for s in sources if str(s.stage) == str(stage)] return sources |
def refs(self): """Iterate over downloadable sources -- references and templates""" def set_bundle(s): s._bundle = self return s return list(set_bundle(s) for s in self.dataset.sources if not s.is_downloadable) |
def build_source_files(self): """Return acessors to the build files""" from .files import BuildSourceFileAccessor return BuildSourceFileAccessor(self, self.dataset, self.source_fs) |
def build_partition_fs(self): """Return a pyfilesystem subdirectory for the build directory for the bundle. This the sub-directory of the build FS that holds the compiled SQLite file and the partition data files""" base_path = os.path.dirname(self.identity.cache_key) if not self.build_fs.exists(base_path): self.build_f... |
def build_ingest_fs(self): """Return a pyfilesystem subdirectory for the ingested source files""" base_path = 'ingest' if not self.build_fs.exists(base_path): self.build_fs.makedir(base_path, recursive=True, allow_recreate=True) return self.build_fs.opendir(base_path) |
def phase_search_names(self, source, phase): """Search the bundle.yaml metadata file for pipeline configurations. Looks for: - <phase>-<source_table> - <phase>-<dest_table> - <phase>-<source_name> """ search = [] assert phase is not None # Create a search list of names for getting a pipline from the metadata if source ... |
def logger(self): """The bundle logger.""" if not self._logger: ident = self.identity if self.multi: template = '%(levelname)s %(process)d {} %(message)s'.format(ident.vid) else: template = '%(levelname)s {} %(message)s'.format(ident.vid) try: file_name = self.build_fs.getsyspath(self.log_file) self._logger = get_logge... |
def log_to_file(self, message): """Write a log message only to the file""" with self.build_fs.open(self.log_file, 'a+') as f: f.write(unicode(message + '\n')) |
def error(self, message, set_error_state=False): """Log an error messsage. :param message: Log message. """ if set_error_state: if message not in self._errors: self._errors.append(message) self.set_error_state() self.logger.error(message) |
def exception(self, e): """Log an error messsage. :param e: Exception to log. """ self.logged_exception(e) self.logger.exception(e) |
def logged_exception(self, e): """Record the exception, but don't log it; it's already been logged :param e: Exception to log. """ if str(e) not in self._errors: self._errors.append(str(e)) self.set_error_state() self.buildstate.state.exception_type = str(e.__class__.__name__) self.buildstate.state.exception = str(e) |
def warn(self, message): """Log an error messsage. :param message: Log message. """ if message not in self._warnings: self._warnings.append(message) self.logger.warn(message) |
def fatal(self, message): """Log a fatal messsage and exit. :param message: Log message. """ self.logger.fatal(message) sys.stderr.flush() if self.exit_on_fatal: sys.exit(1) else: raise FatalError(message) |
def log_pipeline(self, pl): """Write a report of the pipeline out to a file """ from datetime import datetime from ambry.etl.pipeline import CastColumns self.build_fs.makedir('pipeline', allow_recreate=True) try: ccp = pl[CastColumns] caster_code = ccp.pretty_code except Exception as e: caster_code = str(e) templ = u("... |
unexpected keyword argument 'encoding' if isinstance(self.build_fs, LazyFS): self.build_fs.wrapped_fs.setcontents(path, v, encoding='utf8') else: self.build_fs.setcontents(path, v, encoding='utf8') |
def pipeline(self, source=None, phase='build', ps=None): """ Construct the ETL pipeline for all phases. Segments that are not used for the current phase are filtered out later. :param source: A source object, or a source string name :return: an etl Pipeline """ from ambry.etl.pipeline import Pipeline, PartitionWriter f... |
pipe_name = source.pipeline try: pipe_config = self.metadata.pipelines[pipe_name] except KeyError: raise ConfigurationError("Pipeline '{}' declared in source '{}', but not found in metadata" .format(source.pipeline, source.name)) else: pipe_name, pipe_config = self._find_pipeline(source, phase) if pipe_name: pl.name = ... |
dict(body=body, store=store) if pipe_config: pl.configure(pipe_config) apply_config(pl, pipe_config) # One more time, for the configuration for 'all' phases if 'all' in self.metadata.pipelines: apply_config(pl, self.metadata.pipelines['all']) # Allows developer to over ride pipe configuration in code self.edit_pipeline... |
def field_row(self, fields): """ Return a list of values to match the fields values. This is used when listing bundles to produce a table of information about the bundle. :param fields: A list of names of data items. :return: A list of values, in the same order as the fields input The names in the fields llist can be: ... |
section, ie: about.title _, key = f.split('.') row[i] = self.metadata.about[key] elif f.startswith('state'): _, key = f.split('.') row[i] = self.buildstate.state[key] elif f.startswith('count'): _, key = f.split('.') if key == 'sources': row[i] = len(self.dataset.sources) elif key == 'tables': row[i] = len(self.dataset... |
def source_pipe(self, source, ps=None): """Create a source pipe for a source, giving it access to download files to the local cache""" if isinstance(source, string_types): source = self.source(source) source.dataset = self.dataset source._bundle = self iter_source, source_pipe = self._iterable_source(source, ps) if sel... |
def get_source(self, source, clean=False, callback=None): """ Download a file from a URL and return it wrapped in a row-generating acessor object. :param spec: A SourceSpec that describes the source to fetch. :param account_accessor: A callable to return the username and password to use for access FTP and S3 URLs. :par... |
return download(spec.url, cache_fs, account_accessor, clean=clean, logger=self.logger, callback=callback) if url_type == 'file': from fs.opener import fsopen syspath = spec.url.replace('file://', '') cache_path = syspath.strip('/') cache_fs.makedir(os.path.dirname(cache_path), recursive=True, allow_recreate=True) if os... |
file_type = 'gs' elif url_type == 'socrata': spec.encoding = 'utf8' spec.header_lines = [0] spec.start_line = 1 url = SocrataSource.download_url(spec) fstor = DelayedDownload(url, cache_fs) file_type = 'socrata' else: fstor = DelayedOpen(cache_fs, cache_path, 'rb') file_type = spec.get_filetype(fstor.path) spec.filetyp... |
def error_state(self): """Set the error condition""" self.buildstate.state.lasttime = time() self.buildstate.commit() return self.buildstate.state.error |
def state(self, state): """Set the current build state and record the time to maintain history. Note! This is different from the dataset state. Setting the build set is commiteed to the progress table/database immediately. The dstate is also set, but is not committed until the bundle is committed. So, the dstate change... |
def record_stage_state(self, phase, stage): """Record the completion times of phases and stages""" key = '{}-{}'.format(phase, stage if stage else 1) self.buildstate.state[key] = time() |
def set_last_access(self, tag): """Mark the time that this bundle was last accessed""" import time # time defeats check that value didn't change self.buildstate.access.last = '{}-{}'.format(tag, time.time()) self.buildstate.commit() |
def sync_in(self, force=False): """Synchronize from files to records, and records to objects""" self.log('---- Sync In ----') self.dstate = self.STATES.BUILDING for path_name in self.source_fs.listdir(): f = self.build_source_files.instance_from_name(path_name) if not f: self.warn('Ignoring unknown file: {}'.format(pat... |
def sync_in_files(self, force=False): """Synchronize from files to records""" self.log('---- Sync Files ----') self.dstate = self.STATES.BUILDING for f in self.build_source_files: if self.source_fs.exists(f.record.path): # print f.path, f.fs_modtime, f.record.modified, f.record.source_hash, f.fs_hash if f.fs_is_newer o... |
def sync_in_records(self, force=False): """Synchronize from files to records""" self.log('---- Sync Files ----') for f in self.build_source_files: f.record_to_objects() # Only the metadata needs to be driven to the objects, since the other files are used as code, # directly from the file record. self.build_source_files... |
def sync_out(self, file_name=None, force=False): """Synchronize from objects to records""" self.log('---- Sync Out ----') from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING for f in self.build_source_files.list_records(): if (f.sync_dir() == BuildSourceFile.SYNC_DIR.RECORD_TO_FILE or f.re... |
def sync_objects_in(self): """Synchronize from records to objects""" self.dstate = self.STATES.BUILDING self.build_source_files.record_to_objects() |
def sync_objects_out(self, force=False): """Synchronize from objects to records, and records to files""" self.log('---- Sync Objects Out ----') from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING for f in self.build_source_files.list_records(): self.log('Sync: {}'.format(f.record.path)) f.... |
def sync_code(self): """Sync in code files and the meta file, avoiding syncing the larger files""" from ambry.orm.file import File from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.BUILD, File.BSFILE.META, File.BSFILE.LIB, File.BSFILE.TEST, File.BSFILE.D... |
def sync_sources(self, force=False): """Sync in only the sources.csv file""" from ambry.orm.file import File self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SOURCES]: bsf = self.build_source_files.file(fc) if bsf.fs_is_newer or force: self.log('Syncing {}'.format(bsf.file_name)) bsf.fs_to_objects()... |
def sync_schema(self): """Sync in code files and the meta file, avoiding syncing the larger files""" from ambry.orm.file import File from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SCHEMA, File.BSFILE.SOURCESCHEMA]: bsf = self.build_source_files.file(f... |
def update_schema(self): """Propagate schema object changes to file records""" self.commit() self.build_source_files.schema.objects_to_record() self.commit() |
def clean(self, force=False): """Clean generated objects from the dataset, but only if there are File contents to regenerate them""" if self.is_finalized and not force: self.warn("Can't clean; bundle is finalized") return False self.log('---- Cleaning ----') self.state = self.STATES.CLEANING self.dstate = self.STATES.B... |
def clean_except_files(self): """Clean everything except the build source files""" if self.is_finalized: self.warn("Can't clean; bundle is finalized") return False self.log('---- Cleaning ----') self.state = self.STATES.CLEANING self.commit() self.clean_sources() self.clean_tables() self.clean_partitions() self.clean_b... |
def clean_sources(self): """Like clean, but also clears out files. """ for src in self.dataset.sources: src.st_id = None src.t_id = None self.dataset.sources[:] = [] self.dataset.source_tables[:] = [] self.dataset.st_sequence_id = 1 |
def clean_partitions(self): """Delete partition records and any built partition files. """ import shutil from ambry.orm import ColumnStat # FIXME. There is a problem with the cascades for ColumnStats that prevents them from # being deleted with the partitions. Probably, they are seen to be owed by the columns instead. ... |
def clean_build(self): """Delete the build directory and all ingested files """ import shutil if self.build_fs.exists: try: shutil.rmtree(self.build_fs.getsyspath('/')) except NoSysPathError: pass |
def clean_ingested(self): """"Clean ingested files""" for s in self.sources: df = s.datafile if df.exists and not s.is_partition: df.remove() s.state = s.STATES.NEW self.commit() |
def clean_process_meta(self): """Remove all process and build metadata""" ds = self.dataset ds.config.build.clean() ds.config.process.clean() ds.commit() self.state = self.STATES.CLEANED |
def clean_source_files(self): """Remove the schema.csv and source_schema.csv files""" self.build_source_files.file(File.BSFILE.SOURCESCHEMA).remove() self.build_source_files.file(File.BSFILE.SCHEMA).remove() self.commit() |
def ingest(self, sources=None, tables=None, stage=None, force=False, load_meta=False): """Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run_stage, all of the source... |
return True try: return s.is_processable and not s.is_ingested and not s.is_built except (IOError, zlib.error): s.local_datafile.remove() return True sources = sorted(self._resolve_sources(sources, tables, stage, predicate=not_final_or_delete), key=key) if not sources: self.log('No sources left to ingest') return self.... |
source_pipe = self.source_pipe(sources[0]) try: meta = iterable_source.meta if meta: self.metadata.about.title = meta['title'] self.metadata.about.summary = meta['summary'] self.build_source_files.bundle_meta.objects_to_record() except AttributeError as e: self.warn("Failed to set metadata: {}".format(e)) pass else: se... |
def _ingest_sources(self, sources, stage, force=False): """Ingest a set of sources, usually for one stage""" from concurrent import ingest_mp self.state = self.STATES.INGESTING downloadable_sources = [s for s in sources if force or (s.is_processable and not s.is_ingested and not s.is_built)] errors = 0 with self.progre... |
only handle one source before exiting. result = pool.map_async(ingest_mp, args, 1) pool.close() pool.join() except KeyboardInterrupt: self.log('Got keyboard interrrupt; terminating workers') pool.terminate() raise else: for i, source in enumerate(downloadable_sources, 1): ps.add( message='Ingesting source #{}, {}'.form... |
def _ingest_source(self, source, ps, force=None): """Ingest a single source""" from ambry.bundle.process import call_interval try: from ambry.orm.exc import NotFoundError if not source.is_partition and source.datafile.exists: if not source.datafile.is_finalized: source.datafile.remove() elif force: source.datafile.remo... |
message='Ingesting {}: rate: {}'.format(source.spec.name, rate), item_count=n_records) source.datafile.load_rows(iterable_source, callback=ingest_progress_f, limit=500 if self.limited_run else None, intuit_type=True, run_stats=False) if source.datafile.meta['warnings']: for w in source.datafile.meta['warnings']: self.e... |
def source_schema(self, sources=None, tables=None, clean=False): """Process a collection of ingested sources to make source tables. """ sources = self._resolve_sources(sources, tables, None, predicate=lambda s: s.is_processable) for source in sources: source.update_table() self.log("Creating source schema for '{}': Tab... |
def schema(self, sources=None, tables=None, clean=False, force=False, use_pipeline=False): """ Generate destination schemas. :param sources: If specified, build only destination tables for these sources :param tables: If specified, build only these tables :param clean: Delete tables and partitions first :param force: P... |
table_sources: pl = self.pipeline(source) pl.cast = [ambry.etl.CastSourceColumns] pl.select_partition = [] pl.write = [Head, Collect] pl.final = [] self.log_pipeline(pl) pl.run() pl.phase = 'build_schema' self.log_pipeline(pl) for h, c in zip(pl.write[Collect].headers, pl.write[Collect].rows[1]): c = t.add_column(name=... |
enumerate(source.source_table.columns) columns = sorted(set([(i, col.dest_header, col.datatype, col.description, col.has_codes) for source in table_sources for i, col in source_cols(source)])) initial_count = len(t.columns) for pos, name, datatype, desc, has_codes in columns: kwds = dict( name=name, datatype=datatype, ... |
def _reset_build(self, sources): """Remove partition datafiles and reset the datafiles to the INGESTED state""" from ambry.orm.exc import NotFoundError for p in self.dataset.partitions: if p.type == p.TYPE.SEGMENT: self.log("Removing old segment partition: {}".format(p.identity.name)) try: self.wrap_partition(p).local_... |
def build(self, sources=None, tables=None, stage=None, force=False): """ :param phase: :param stage: :param sources: Source names or destination table names. :return: """ from operator import attrgetter from itertools import groupby from .concurrent import build_mp, unify_mp from ambry.bundle.events import TAG self.log... |
stage {}'.format(stage)) return True if not self.pre_build(force): ps.update(message='Pre-build failed', state='skipped') return False if force: self._reset_build(resolved_sources) resolved_sources.reload() e = [ (stage, SourceSet(self, list(stage_sources))) for stage, stage_sources in groupby(sorted(resolved_sources, ... |
coalescing' .format(len(completed_sources))) partition_names = [(self.identity.vid, k) for k, v in self.collect_segment_partitions().items()] r = pool.map_async(unify_mp, partition_names, 1) completed_partitions = r.get() ps.add('Finished MP coalescing {} partitions'.format(len(completed_partitions))) pool.close() pool... |
def build_table(self, table, force=False): """Build all of the sources for a table """ sources = self._resolve_sources(None, [table]) for source in sources: self.build_source(None, source, force=force) self.unify_partitions() |
def build_source(self, stage, source, ps, force=False): """Build a single source""" from ambry.bundle.process import call_interval assert source.is_processable, source.name if source.state == self.STATES.BUILT and not force: ps.update(message='Source {} already built'.format(source.name), state='skipped') return pl = s... |
the end of the pipelin for f in pl.final: ps.update(message='Run final routine: {}'.format(f.__name__)) f(pl) ps.update(message='Finished building source') except: self.log_pipeline(pl) raise self.commit() try: partitions = list(pl[ambry.etl.PartitionWriter].partitions) ps.update(message='Finalizing segment partition',... |
def collect_segment_partitions(self): """Return a dict of segments partitions, keyed on the name of the parent partition """ from collections import defaultdict # Group the segments by their parent partition name, which is the # same name, but without the segment. partitions = defaultdict(set) for p in self.dataset.par... |
def unify_partitions(self): """For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children. """ partitions = self.collect_segment_partitions() # For each group, copy the segment partitions to the parent partitions, then # delete the segment partiti... |
def exec_context(self, **kwargs): """Base environment for evals, the stuff that is the same for all evals. Primarily used in the Caster pipe""" import inspect import dateutil.parser import datetime import random from functools import partial from ambry.valuetype.types import parse_date, parse_time, parse_datetime impor... |
a lambda prevents the param assignment localvars['randint'] = lambda a, b: random.randint(a, b) if self != Bundle: # Functions from the bundle base = set(inspect.getmembers(Bundle, predicate=inspect.isfunction)) mine = set(inspect.getmembers(self.__class__, predicate=inspect.isfunction)) localvars.update({f_name: set_f... |
'module') for f_name, func in module_entries}) return localvars |
def post_build_time_coverage(self): """Collect all of the time coverage for the bundle.""" from ambry.util.datestimes import expand_to_years years = set() # From the bundle about if self.metadata.about.time: for year in expand_to_years(self.metadata.about.time): years.add(year) # From the bundle name if self.identity.b... |
def post_build_geo_coverage(self): """Collect all of the geocoverage for the bundle.""" spaces = set() grains = set() def resolve(term): places = list(self.library.search.search_identifiers(term)) if not places: raise BuildError( "Failed to find space identifier '{}' in full text identifier search".format(term)) return... |
def is_finalized(self): """Return True if the bundle is installed.""" return self.state == self.STATES.FINALIZED or self.state == self.STATES.INSTALLED |
def _run_events(self, tag, stage=None): """Run tests marked with a particular tag and stage""" self._run_event_methods(tag, stage) self._run_tests(tag, stage) |
def _run_event_methods(self, tag, stage=None): """Run code in the bundle that is marked with events. """ import inspect from ambry.bundle.events import _runable_for_event funcs = [] for func_name, f in inspect.getmembers(self, predicate=inspect.ismethod): if _runable_for_event(f, tag, stage): funcs.append(f) for func i... |
def is_installed(self): """Return True if the bundle is installed.""" r = self.library.resolve(self.identity.vid) return r is not None |
def include(prop): '''Replicate property that is normally not replicated. Right now it's meaningful for one-to-many relations only.''' if isinstance(prop, QueryableAttribute): prop = prop.property assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty)) #assert isinstance(prop, RelationshipProperty) _inc... |
def exclude(prop): '''Don't replicate property that is normally replicated: ordering column, many-to-one relation that is marked for replication from other side.''' if isinstance(prop, QueryableAttribute): prop = prop.property assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty)) _excluded.add(prop) i... |
def reflect(source, model, cache=None): '''Finds an object of class `model` with the same identifier as the `source` object''' if source is None: return None if cache and source in cache: return cache[source] db = object_session(source) ident = identity_key(instance=source)[1] assert ident is not None return db.query(m... |
def replicate_attributes(source, target, cache=None): '''Replicates common SQLAlchemy attributes from the `source` object to the `target` object.''' target_manager = manager_of_class(type(target)) column_attrs = set() relationship_attrs = set() relationship_columns = set() for attr in manager_of_class(type(source)).att... |
def replicate_no_merge(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' # `cache` is used to break circular dependency: we need to replicate # attributes before merging target into the session, but replication of # some attributes may require target to be in ... |
def replicate(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' target = replicate_no_merge(source, model, cache=cache) if target is not None: db = object_session(source) target = db.merge(target) return target |
def replicate_filter(sources, model, cache=None): '''Replicates the list of objects to other class and returns their reflections''' targets = [replicate_no_merge(source, model, cache=cache) for source in sources] # Some objects may not be available in target DB (not published), so we # have to exclude None from the lis... |
def reflect_filter(sources, model, cache=None): '''Returns the list of reflections of objects in the `source` list to other class. Objects that are not found in target table are silently discarded. ''' targets = [reflect(source, model, cache=cache) for source in sources] # Some objects may not be available in target DB... |
def valuetype_class(self): """Return the valuetype class, if one is defined, or a built-in type if it isn't""" from ambry.valuetype import resolve_value_type if self.valuetype: return resolve_value_type(self.valuetype) else: return resolve_value_type(self.datatype) |
def python_type(self): """Return the python type for the row, possibly getting it from a valuetype reference """ from ambry.valuetype import resolve_value_type if self.valuetype and resolve_value_type(self.valuetype): return resolve_value_type(self.valuetype)._pythontype elif self.datatype: try: return self.types[self.... |
def role(self): '''Return the code for the role, measure, dimension or error''' from ambry.valuetype.core import ROLE if not self.valuetype_class: return '' role = self.valuetype_class.role if role == ROLE.UNKNOWN: vt_code = self.valuetype_class.vt_code if len(vt_code) == 1 or vt_code[1] == '/': return vt_code[0] else:... |
def is_dimension(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.DIMENSION |
def is_measure(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.MEASURE |
def is_label(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.LABEL |
def is_error(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.ERROR |
def children(self): """"Return the table's other column that have this column as a parent, excluding labels""" for c in self.table.columns: if c.parent == self.name and not c.valuetype_class.is_label(): yield c |
def label(self): """"Return first child of the column that is marked as a label. Returns self if the column is a label""" if self.valuetype_class.is_label(): return self for c in self.table.columns: if c.parent == self.name and c.valuetype_class.is_label(): return c return None |
def geoid(self): """"Return first child of the column, or self that is marked as a geographic identifier""" if self.valuetype_class.is_geoid(): return self for c in self.table.columns: if c.parent == self.name and c.valuetype_class.is_geoid(): return c |
def python_cast(self, v): """Cast a value to the type of the column. Primarily used to check that a value is valid; it will throw an exception otherwise """ if self.type_is_time(): dt = dateutil.parser.parse(v) if self.datatype == Column.DATATYPE_TIME: dt = dt.time() if not isinstance(dt, self.python_type): raise TypeE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.