Loop through the datastore's datasources to find
    the datasource identified by datasource_id, return
    the matching datasource's columns.
187077
def discover_datasource_columns(datastore_str, datasource_id):
    
    datastore = DataStore(datastore_str)
    datasource = datastore.get_datasource(datasource_id)
    if datasource.type != "RASTER":
        return datasource.list_columns()
    else:
        return []
147698
protected DataSource getDataSource() throws RepositoryException
   {
      try
      {
         return containerConfig.dsProvider.getDataSource(containerConfig.dbSourceName);
      }
      catch (NamingException e)
      {
         throw new RepositoryException("Datasource '" + containerConfig.dbSourceName
            + "' is not bound in this context.", e);
      }
   }
837995
def index(self, datastore_id=None):
        
        datastore = self._get_datastore_by_id(datastore_id)
        if datastore is None:
            abort(404)
        discovery_result = discover_datasources(datastore.ogrstring)
        for datasource in discovery_result:
            datasource['href'] = h.url_for(controller="datasources", action="show", datastore_id=datastore_id, datasource_id=datasource['id'])
        # prevent JSON Array Cross-site Exploits (XSRF/CSRF)
        return {'datasources': discovery_result}
86557
@SneakyThrows
    public DataSource createDataSource() {
        DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance();
        Method[] methods = result.getClass().getMethods();
        for (Entry<String, Object> entry : properties.entrySet()) {
            if (SKIPPED_PROPERTY_NAMES.contains(entry.getKey())) {
                continue;
            }
            Optional<Method> setterMethod = findSetterMethod(methods, entry.getKey());
            if (setterMethod.isPresent()) {
                setterMethod.get().invoke(result, entry.getValue());
            }
        }
        return result;
    }
83741
def _update_datasource(self, source, data):
        
        if isinstance(source, ColumnDataSource):
            if self.handles['static_source']:
                source.trigger('data', source.data, data)
            else:
                source.data.update(data)
        else:
            source.graph_layout = data
756529
function findDataSource(connections, dataSource, cb) {
  var query = {

  };

  //Searching By ID.
  query[CONSTANTS.DATA_SOURCE_ID] = dataSource[CONSTANTS.DATA_SOURCE_ID];

  //Looking up a full data source document as we are updating
  lookUpDataSources(connections, {
    query: query,
    lean: false
  }, function(err, dataSources) {
    if (err) {
      return cb(buildErrorResponse({
        error: err,
        userDetail: "Unexpected Error When Searching For A Data Source",
        code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
      }));
    }

    //Should only be one data source
    if (dataSources.length !== 1) {
      return cb(buildErrorResponse({
        error: new Error("Data Source Not Found"),
        systemDetail: "Requested ID: "  + dataSource[CONSTANTS.DATA_SOURCE_ID],
        code: ERROR_CODES.FH_FORMS_NOT_FOUND
      }));
    }

    return cb(undefined, dataSource, dataSources[0]);
  });
}
1357060
public DataSource getDataSource() {
        if(dataSource == null) {
            LOG.info("Having to construct a new DataSource");

            dataSource = new DataSource();

            dataSource.setDriverClassName(dbSettings.getDriver());
            dataSource.setUrl(dbSettings.getJdbcUrl());
            dataSource.setUsername(dbSettings.getUser());
            dataSource.setPassword(dbSettings.getPass());

            dataSource.setMaxActive(dbSettings.getMaxActive());
            dataSource.setMaxIdle(dbSettings.getMaxIdle());
            dataSource.setMinIdle(dbSettings.getMinIdle());
            dataSource.setInitialSize(dbSettings.getInitialSize());
            dataSource.setTestOnBorrow(dbSettings.getTestOnBorrow());
            dataSource.setTestOnReturn(dbSettings.getTestOnReturn());
            dataSource.setTestWhileIdle(dbSettings.getTestWhileIdle());
            dataSource.setValidationQuery(dbSettings.getValidationQuery());
            dataSource.setLogValidationErrors(dbSettings.getLogValidationErrors());

            // a catch-all for any other properties that are needed
            dataSource.setDbProperties(dbSettings.getProperties());
        }

        return dataSource;
    }
338082
def _get_datatable_options(self):
        
        if not hasattr(self, '_datatable_options'):
            self._datatable_options = self.get_datatable_options()

            # Convert sources from list to tuple, so that modern Column tracking dicts can hold the
            # field definitions as keys.
            columns = self._datatable_options.get('columns', [])
            for i, column in enumerate(columns):
                if len(column) >= 2 and isinstance(column[1], list):
                    column = list(column)
                    column[1] = tuple(column[1])
                    columns[i] = tuple(column)

        return self._datatable_options
576141
private DataSource lookupDS(InitialContext ctx, String path) {
        try {
            return (DataSource) ctx.lookup(path);
        } catch (NamingException e) {
            return null;
        }
    }
336057
private static Column getCurrentResourceColumn(DataSource dataSource, Integer size,
      Resource currentResource, String itemResourceType) {

    Iterator<Resource> items = dataSource.iterator();

    boolean hasMore = false;
    if (size != null) {
      List<Resource> list = new ArrayList<Resource>();
      while (items.hasNext() && list.size() < size) {
        list.add(items.next());
      }
      hasMore = items.hasNext();
      items = list.iterator();
    }

    Column column = new Column()
        .columnId(currentResource.getPath())
        .hasMore(hasMore)
        .metaElement(true);
    while (items.hasNext()) {
      Resource item = items.next();
      column.addItem(new ColumnItem(item)
          .resourceType(itemResourceType));
    }

    return column;
  }
56172
private byte[] getDataSourceMetadataWithHandleAsBytes(
      final Handle handle,
      final String dataSource
  )
  {
    return connector.lookupWithHandle(
        handle,
        dbTables.getDataSourceTable(),
        "dataSource",
        "commit_metadata_payload",
        dataSource
    );
  }
641482
public static Database getDatabase(DataSource dataSource) {
		if (dataSource == null) {
			return Database.DEFAULT;
		}
		try {
			String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
			DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(url);
			Database database = LOOKUP.get(driver);
			if (database != null) {
				return database;
			}
		}
		catch (MetaDataAccessException ex) {
			logger.warn("Unable to determine jdbc url from datasource", ex);
		}
		return Database.DEFAULT;
	}
149089
def _get_dataframe(self):
        
        if self.source_conn is None:  # Use local file
            return ge.read_csv(self.dataset_name, **self.dataset_params)

        if isinstance(self.source_conn, S3Hook):
            hook = ExpectationS3CsvHook(aws_conn_id=self.source_conn_id)

            return hook.get_ge_df(self.dataset_name, self.source_bucket_name, **self.dataset_params)

        if isinstance(self.source_conn, DbApiHook):
            hook = ExpectationMySQLHook(mysql_conn_id=self.source_conn_id)

            return hook.get_ge_df(self.dataset_name, **self.dataset_params)
712567
def columns(self):
        
        return Index(np.array(self._gather_column_names(), dtype=np.bytes_), np.dtype(np.bytes_))
234963
public DataStore getDataStore(final Collection<String> columns) {
        for (DataStore ds : dataBatches) {
            if (ds.hasColumns(columns)) {
                return ds;
            }
        }
        return null;
    }
529151
def get_value_for_datastore(self, model_instance):
        """"""
        table_id = getattr(model_instance, self.table_fieldname, None)
        object_id = getattr(model_instance, self.object_fieldname, None)
        return table_id, object_id
828224
def find(self, id, columns=None):
        
        if columns is None:
            columns = ["*"]

        if isinstance(id, list):
            return self.find_many(id, columns)

        self._query.where(self._model.get_qualified_key_name(), "=", id)

        return self.first(columns)