コード例 #1
0
ファイル: sql.py プロジェクト: mara/mara-pipelines
 def _copy_command(self, target_table, replace):
     """Helper function for creating the actual copy command"""
     return (_SQLCommand.shell_command(self)
             + '  | ' + shell.sed_command(replace)
             + '  | ' + mara_db.shell.copy_command(self.source_db_alias, self.target_db_alias,
                                                   target_table, timezone=self.timezone,
                                                   csv_format=self.csv_format, delimiter_char=self.delimiter_char))
コード例 #2
0
ファイル: sql.py プロジェクト: mara/mara-pipelines
    def shell_command(self):
        if self.sql_file_name:
            command = 'cat ' + shlex.quote(str(self.sql_file_path().absolute())) + ' \\\n'
        else:
            command = f'echo {shlex.quote(self.sql_statement)} \\\n'

        if self.replace:
            command += '  | ' + shell.sed_command(_expand_pattern_substitution(self.replace)) + ' \\\n'
        return command